ClimoC
Well-known Member
- Joined
- Aug 21, 2009
- Messages
- 584
Ello
I have a disconnected ADODB, which userforms access. To search for items to perform actions on, there are 2 comboboxes. The first is my custom 'UniqueID' string ("AAAAA, AAAAB, etc"). The second is has two columns, the first is the Unique ID again, the second (which is ALSO THE BOUND COLUMN), is the Name of the entry in the dataset.
What I'm trying to do, is allow people to select/type the Unique ID (if they know it), but also be able to type/select by the Name.
I had it at the point where you type/select the UniqueID from CB1, and it picks AN entry from CB2 with a similar name (match an item from the bound column with the field value 'Name' from the UID), but anything with a duplicate name caused it to grab anything that matched that name.
So the tricky thing I need to do - and I don't know if I even can, is this:
1) Pick the UID from CB1, and it grabs the CORRECT entry from CB2 based on the CB2.Column(0)
2) be able to use CB2 to bring up Text-matching entries from Bound Column 2
Any ideas?
So far, I have:
...And that doesn't work.... "Runtime 381 - Could not set the Columm property. Invalid property array Index."
And the other...
Grabs the first entry it finds with a matching name. (So if 3 records with their own UID's have the same name, and you pick the second or third one by Name, the first UID is selected!)
Any comments/suggestions welcome
Cheers
C
I have a disconnected ADODB, which userforms access. To search for items to perform actions on, there are 2 comboboxes. The first is my custom 'UniqueID' string ("AAAAA, AAAAB, etc"). The second is has two columns, the first is the Unique ID again, the second (which is ALSO THE BOUND COLUMN), is the Name of the entry in the dataset.
What I'm trying to do, is allow people to select/type the Unique ID (if they know it), but also be able to type/select by the Name.
I had it at the point where you type/select the UniqueID from CB1, and it picks AN entry from CB2 with a similar name (match an item from the bound column with the field value 'Name' from the UID), but anything with a duplicate name caused it to grab anything that matched that name.
So the tricky thing I need to do - and I don't know if I even can, is this:
1) Pick the UID from CB1, and it grabs the CORRECT entry from CB2 based on the CB2.Column(0)
2) be able to use CB2 to bring up Text-matching entries from Bound Column 2
Any ideas?
So far, I have:
Code:
Private Sub Combobox1_Change()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
OFFLDb.MoveFirst
OFFLDb.Find = "UniqueID = '" & ComboBox1.Value & "'"
If Not OFFLDb.EOF = True And Not OFFLDb.BOF = True Then
With OFFLDb
Me.ComboBox2.Column(0) = .Fields("UniqueID").Value
End With
End If
End Sub
And the other...
Code:
Private Sub Combobox1_Change()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
OFFLDb.MoveFirst
OFFLDb.Find = "UniqueID = '" & ComboBox1.Value & "'"
If Not OFFLDb.EOF = True And Not OFFLDb.BOF = True Then
With OFFLDb
Me.ComboBox2.Column(1) = .Fields("Name").Value
End With
End If
End Sub
Any comments/suggestions welcome
Cheers
C