combo box with two fields

  • Thread starter Thread starter Stu_J
  • Start date Start date
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?
 
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
 
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
 
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

Back
Top Bottom