Moe,
To go to the record use the AfterUpdate event of the combo:
If The Bound Column of the combo is Column(1),*which is the way it
shoud be*, you refer to the combo box rather then to a column, to
select that record:
Private Sub combo12_AfterUpdate()
DoCmd.GoToControl "OrderID"
DoCmd.FindRecord Me.Combo12
'Note: no equal sign
DoCmd.GoToControl "Whatever"
End Sub
(no need to refer to a recordset)
In order to have the combo display the correct record you are on, if
you have not done it yet, use the OnCurrent event of the *form*
Private sub Form_Current()
Me.Combo12=Me.OrderID
End Sub
If Column 1 is *not* the bound column, it is a string (eg "223", not
223) thus needs to be converted to number because OrderID on the form
is a number. Change the second staement of the AfterUpdate event to:
DoCmd.FindRecord Val(Me.Combo12.Column(1))
Howver in this case your combo may not retun the correct record you are
on
Hope this is of help
Regards
Jacob
Thanks Jacob, that helped. Now can you tell me how we can do this by VBA. I
tried rs.Find ("[CustomerID] = '" & Me![Combo12] & "'" And "[OrderID] = '" &
Me![Combo12].Column(1) & "'") but it did not work I need to know how to use
"Find" or "FindFirst" method with two conditions. Like looking for a record
in a form or table where, for example, CustomerID AND OrderID match specific
fields of the form.
Jacob said:
Looks like the Bound column of your combo is the customer or the
customerID, change the bound colomn to the Invoice identifier that
appears on the form. That should sove the problem
Regards/JK
In my combobox each Customer field has several Invoices. therefore, no matter
which of the records I select the first record for that Customer will fill in
the fields of the form. For example Customer_1 has invoice_1, invoice_2 and
invoice_3. No matter which invoice I select in the combobox, invoice_1 will
be used to fill in the form. I tried to use "rs.Find ("[CustomerID] = '" &
Me![Combo12] & "'" And "[InvoiceID] = '" & Me![Combo12].Column(1) & "'") in
the AfterUpdate Event of the combobox but it did not work. any idea?