combobox coloums

paulevans

Registered User.
Local time
Today, 01:33
Joined
Mar 7, 2006
Messages
79
Hi I am struggling with this one.

I have a combobox that uses the following row source

SELECT [General Query1].[compinfo], [General Query1].[ID] FROM [General Query1] ORDER BY [compinfo];

I want the user to select one of the options which I then need to find out the comapny ane and also the index id

IHave tried the following without luck

Private Sub Combo22_Change()
Dim testtxt1 As String
Dim testtxt2 As String

testtxt1 = Me![Combo22].ItemData(0)
testtxt2 = Me![Combo22].ItemData(1)

MsgBox testtxt1, vbOKOnly
MsgBox testtxt2, vbOKOnly
End Sub


Any Ideas Please
 
In a combo box, reference the column number of the criteria you are looking for:

Me.Combo22.column(0) will return compinfo
Me.Combo22.column(1) will return ID
 
Thanks very much for that.

That was just what I wanted.
 

Users who are viewing this thread

Back
Top Bottom