Can I do this?

J

Jerry

Hi,
I have a form bound to a table 'Customers' with a combo box
(cboCustomerName) for the CustomerName field and text boxes for the other
fields in each customer record. What I want to be able to do is to select
the name of a customer in cboCustomerName and have the form find that
customer's information. cboCustomerName's control source is
Customers.CustomerName, bound column is 2 (CustomerName), and column count
is 2 so it pulls CustomerID and CustomerName. The AfterUpdate event handler
has this in it:

Private Sub cboCustomerName_AfterUpdate()
'Move to the record selected in the control
Me.RecordsetClone.Findfirst "[CustomerID] = " &
Me![cboCustomerName].Column(0)
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

This works fine to find the record, but it has the side effect of putting
the name of the customer being found in the record of the customer that was
current when the action was initiated. Is there a way to prevent the record
I'm leaving from being altered by the selection in the combo box?
 
R

Reggie

Jerry, Yes. Sounds like you have the combos control source set to a field
in your underlying recordsource. Remove/Delete the control source from the
combobox and probably want to place the combo in the Form header section as
it sounds like you want to use it as a lookup control. Hope this helps!.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top