If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Please Help !
Hi,
I'm designing a "site information" database and I'm hoping you can help me with the following questions/issues I've come up against, please ? 1. I've created a form based on a table to display site information on a one-at-a-time basis. I want to be able to search and display the information by 3 unique fields, ie: name, number and ID. So, the idea is: you open the form, you know which of our 300 sites you want to see the info for and you have the choice of displaying that info by choosing a value from one of 3 combo boxes (ie: you may only know the ID, not the name or number, so you go to the ID field and you hit the arrow to display the list, then you choose which one you're after and the other fields in the form update to display that ID's information). I've currently got the form working with 1 combo box, which updates the rest of the form after choosing a value from the list, but I'm stuck when trying to create the other 2 for search and display as well. Any ideas would be much appreciated ! |
#2
|
|||
|
|||
Please Help !
do your combobox wizards work? There's a wizard that does this...
|
#3
|
|||
|
|||
Please Help !
Actually, you only need one combo box to do your searching. The combo should
not be a bound control. Here are two subs that are the code necessary to use one combo for 3 different search options. You also need an option group with 3 buttons, one for each search filed. First, set the combo's properties to suit the first (Default) choice. Set the Default Value of the option group to 1. Now, adjust the code to suit your fields, names, column widths, etc. Note: all the properties that require sizing (ColumnWidths, etc) are in twips. There are 1440 twips per inch. Now the user just selects how she wants to do the search and the selected record will be displayed: 'Code for the After Update event of the Combo Box: Private Sub cboSearch_AfterUpdate() Dim strFind As String Select Case Me.opgSearch Case 1 strFind = "[Activity] = """ & Me.cboSearch & """" Case 2 strFind = "[itm] = """ & Me.cboSearch & """" Case 3 strFind = "[MActivity] = """ & Me.cboSearch & """" End Select With Me.RecordsetClone .FindFirst strFind If Not .NoMatch Then Me.Bookmark = .Bookmark End If End With End Sub 'Code for the Option Group After Upate: Private Sub opgSearch_AfterUpdate() Select Case Me.opgSearch Case 1 With Me.cboSearch .RowSource = "SELECT DISTINCT Activity, Description FROM " & _ "CisAttributeTable_ME;" .ColumnCount = 2 .ColumnWidths = "1584; 5184" .ListWidth = 6768 .Width = 3312 .Value = Null End With Me.lblSearch.Caption = "Activity" Case 2 With Me.cboSearch .RowSource = "SELECT DISTINCT ITM FROM CisAttributeTable_ME " & _ "WHERE ITM IS NOT NULL;" .ColumnCount = 1 .ColumnWidths = 1584 .ListWidth = 1584 .Width = 1600 .Value = Null End With Me.lblSearch.Caption = "ITM" Case 3 With Me.cboSearch .RowSource = "SELECT DISTINCT MActivity FROM CisAttributeTable_ME " & _ "WHERE MActivity IS NOT NULL;" .ColumnCount = 1 .ColumnWidths = 1584 .ListWidth = 1584 .Width = 2000 .Value = Null End With Me.lblSearch.Caption = "Master" End Select End Sub "Sonja" wrote: Hi, I'm designing a "site information" database and I'm hoping you can help me with the following questions/issues I've come up against, please ? 1. I've created a form based on a table to display site information on a one-at-a-time basis. I want to be able to search and display the information by 3 unique fields, ie: name, number and ID. So, the idea is: you open the form, you know which of our 300 sites you want to see the info for and you have the choice of displaying that info by choosing a value from one of 3 combo boxes (ie: you may only know the ID, not the name or number, so you go to the ID field and you hit the arrow to display the list, then you choose which one you're after and the other fields in the form update to display that ID's information). I've currently got the form working with 1 combo box, which updates the rest of the form after choosing a value from the list, but I'm stuck when trying to create the other 2 for search and display as well. Any ideas would be much appreciated ! |
Thread Tools | |
Display Modes | |
|
|