Combo Box Synchronizing Problem

  • Thread starter Thread starter MarathonCat
  • Start date Start date
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
 
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.
 
Back
Top