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!

Combo requery/F9

Status
Not open for further replies.

Steven811

Technical User
Apr 15, 2004
76
0
0
GB
Hi

I have 2 combo boxes in a form and the value selected in one needs to update the second combo box. This value becomes available via a query to the second combo box.

The archives have provided many variations of the requery function, I've tried many of these to no avail.

When I use F9 it does exactly what I want but I don't know what syntax to use in the AfterUpdate event procedure.

Can anyone help?

Thanks

Steven811


 
I had the same issue not that long ago ... this is what did it for me.

two combo boxes with two tables one being stores the other managers, want the first box to filter the secound and so forth.
-----------------

Private Sub cboStore_AfterUpdate()
Dim sManagerSource As String

sManagerSource = "SELECT [tblManager].[lngManagerID], [tblManager].[lngStoreID], [tblManager].[strManagerName] " & _
"FROM tblManager " & _
"WHERE [lngStoreID] = " & Me.cboStore.Value
Me.cboManager.RowSource = sManagerSource
Me.cboManager.Requery
End Sub
-----------
and here is the query
cbo manager:

SELECT [tblStore].[lngStoreID], [tblStore].[strStoreName] FROM tblStore;

and cbo store:

SELECT [tblManager].[lngManagerID], [tblManager].[lngStoreID], [tblManager].[strManagerName] FROM tblManager;

Dougal [pc3][tongue]
hope this helps ... I am no programmer but I am trying to contribute.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top