Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box not changing when moving to new record 1

Status
Not open for further replies.

Heeeeelp

Technical User
Jan 5, 2006
39
CA
Hi Everyone,
I would appreciate some help.

I have a form that stores company name, contact information, shipping address, etc. All these fields are stored in one table.

I changed the text field for the company name to a combo box so that the company name can easily be selected by the user. When a company name is selected from the combo box, the form updates with the correct information.

However, if I change to the next record using the arrow keys from the record control at the bottom of the form, all of the information changes correctly except for the company name. It remains to what was when i originally selected a company using the combo box.

Can someone please let me know how I code the combo box so that it changes to match the correct company infomation when moving from record to record?

Thank you in advance for your help.

Tess
 
Set the value of the combo in the Current event procedure of the form.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you for the prompt response PH.

Can you please give me an example of how to set the value in the Current event for an unbound combo box.

I'm still learning here.

Thank you again,

Tess
 
Could you, please, share your actual code that updates the form when a company name is selected from the combo box ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Here is the code for updating the form when a company is selected from the combo box:

Private Sub comboCompany_AfterUpdate()

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CustomerID] = " & Str(Me![comboCompany])
Me.Bookmark = rs.Bookmark
End Sub

Thank you,
Tess
 
So, in the Current event procedure of the form:
Me![comboCompany] = Me![CustomerID]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Problem solved!

Thank you, I appreciate your help PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top