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

Fill combobox after running a query from a button

Status
Not open for further replies.

accessuserva

Technical User
Aug 7, 2002
26
US
I have a combobox that I want to populate with specific data from a query after it is run. The query runs fine though it pops up in front of my form...but the combobox remains unfilled.
I have the Rowsourcetype set to qry/table & the Rowsource set to the specific query. The query is not run until after the button is pushed. I have been struggling with this for 3 days now. Just getting my feet wet in access.

the query is named "sitedistance"
the combobox is named "searchresults"

Any help would be greatly appreciated

accessuserva
 
I think, from what you've said, you need to add at the end of the Button_Click event :-

SearchResults.Requery




'ope-that-'elps.

G LS
 
Like So?

Private Sub Sitesearch_Click()
On Error GoTo Err_Sitesearch_Click

Dim stDocName As String

stDocName = "qrySitedistance"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SearchResults.Requery

Exit_Sitesearch_Click:
Exit Sub

Err_Sitesearch_Click:
MsgBox Err.Description
Resume Exit_Sitesearch_Click

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top