Combo Box Synchronizing Problem

M

MarathonCat

I am trying to synchronize 2 combo boxes so that once I select the client in
the first combo box, it will narrow down my options for the SUBClient in the
second combo box

The "pick list" data comes from Queries and I am storing the ID number in a
project table.

Any help would be greatly appreciated!

The is the row source for ComboClient
SELECT [Q SortClient].[ClientID], [Q SortClient].[Client] FROM [Q SortClient];

This is the row source for the ComboSUBClient
SELECT [Q SortSUBClient].[SUBClientID], [Q SortSUBClient].[SUBClient], [Q
SortSUBClient].[Client] FROM [Q SortSUBClient];

This is the code that is not working for me
Private Sub ComboClient_AfterUpdate()
Me.ComboSUBClient.RowSource = "select SUBClientID FROM" & _
" Q SortSUBClient WHERE ClientID = " & _
Me.ComboClient
Me.ComboSUBClient = Me.ComboSUBClient.ItemData(0)
End Sub
 
M

Marshall Barton

MarathonCat said:
I am trying to synchronize 2 combo boxes so that once I select the client in
the first combo box, it will narrow down my options for the SUBClient in the
second combo box

The "pick list" data comes from Queries and I am storing the ID number in a
project table.

Any help would be greatly appreciated!

The is the row source for ComboClient
SELECT [Q SortClient].[ClientID], [Q SortClient].[Client] FROM [Q SortClient];

This is the row source for the ComboSUBClient
SELECT [Q SortSUBClient].[SUBClientID], [Q SortSUBClient].[SUBClient], [Q
SortSUBClient].[Client] FROM [Q SortSUBClient];

This is the code that is not working for me
Private Sub ComboClient_AfterUpdate()
Me.ComboSUBClient.RowSource = "select SUBClientID FROM" & _
" Q SortSUBClient WHERE ClientID = " & _
Me.ComboClient
Me.ComboSUBClient = Me.ComboSUBClient.ItemData(0)
End Sub


You forgot the [] arount the table name:

Me.ComboSUBClient.RowSource = "select SUBClientID FROM" & _
" [Q SortSUBClient] WHERE ClientID = " & Me.ComboClient

If ClientID is a Text field then the SQL statement needs
quotes around the client ID value.
 

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