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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox isn't keeping up with the drop-down value

Status
Not open for further replies.

Accesser

Technical User
Jun 3, 2002
44
0
0
US
Hi there,

This is wierd! I have a combobox, comboCompanies, on a main form. All I want to do is be able to select different CompanyID's from the combobox and have the form update itself to the record I just selected. Don't think I've set this up any differently than other combo's that have fuctioned properly.

On After Update of comboCompanies, is the following code:

' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CompanyID] = " & Str(Me![comboCompanies])
Me.Bookmark = rs.Bookmark

The combo's row source is a query:

SELECT qryCompanyDetails.CompanyID, qryCompanyDetails.CompanyName
FROM qryCompanyDetails
ORDER BY qryCompanyDetails.CompanyID;

The form is based on another query.

After I select a company from the drop down list, I hear my PC kind of struggling for about 1 second. Maybe it's tired after the holidays?!--but it can't be cause it's a good Dell.

About 1/3 of the time after I select something from the drop-down list, the value in the combobox remains as the last value that was in the combobox field, 1/3 of the time it goes to the correct value, and the last 1/3 of the time, the value that appears in the combobox is the value that I highlighted during my previous selection attempt!

I'm using Access 2K.

Does anybody have any ideas on correcting this and/or speeding this up?

Thanks,
Eric
 
Private Sub combo5_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[PN] = '" & Me![combo5] & "' "
Me.Bookmark = rs.Bookmark
End Sub


This is what works for me. Note the slightly different syntax. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top