combo box with two fields (1 Viewer)

S

Stu_J

Guest
I have a combo box that lists the records in order of Surname and order of Forename.

I know that by using "Combo31.Text" in VBA I can access the Surname field, but how do I read the Forename field from VBA?
 

Howlsta

Vampire Slayer
Local time
Today, 23:25
Joined
Jul 18, 2001
Messages
180
You can reference each column like this:

Me.Combo.Column(0)
Me.Combo.Column(1)
etc

The default is column(0), so you don't need to enter this, but if you want to refer to other columns you have to put the extra bit.

HTH

Rich
 

simongallop

Registered User.
Local time
Today, 23:25
Joined
Oct 17, 2000
Messages
611
If you are within the form containing the combo then:

Surname = Me.ComboName.Column(0)
FirstName = Me.ComboName.Column(1)

The column command is offset by 1 ie the first column is column(0) the second is column(1) etc.

HTH
 

cogent1

Registered User.
Local time
Today, 23:25
Joined
May 20, 2002
Messages
315
This is a continuation of a thread you raised earlier, I think. If you base your combo on a query which concatenates First and last Names,you don't have to worry about referencing two columns in your combo.....
 

Users who are viewing this thread

Top Bottom