T
TotallyConfused
I hope someone can please help me complete this. I have a form with an
Option Group consisting of 3 choices: Counties, Cities, Companies. 2 combo
boxes. Combo box 1 - List the names of the choice picked from the Option
Group. Combo Box 2 - should list the doctors in the choice selected from
Combox box 1. That is my problem. I can't get the Combo box 2 to work.
Below is the code for After Update in the Option Group.
Private Sub optsearch_AfterUpdate()
Dim strRowSource As String
Select Case Me.optsearch
Case 1 'County
strRowSource = "SELECT [qry Counties].[CNTY] FROM [qry Counties]"
Case 2 'City
strRowSource = "SELECT [qry Cities].[City] FROM [qry Cities]"
Case 3 'Group
strRowSource = "SELECT [qry Groups].[Company] FROM [qry Groups]"
End Select
Me.PickCounty.RowSource = strRowSource
End Sub
This is the SQL for Combo Box 2 (DOC List)
SELECT DISTINCT [tblOFCTRKG].ID, [tblOFCTRKG].[DOC ID], [tblOFCTRKG].[DOC
NAME], [tblOFCTRKG].[DOC PH], [tblOFCTRKG].[DOC FX], [tblOFCTRKG].[DOC ADD],
[tblOFCTRKG].[DOC ADD2], [tblOFCTRKG].[DOC CITY], [tblOFCTRKG].St,
[tblOFCTRKG].[DOC CNTY] FROM [tblOFCTRKG] GROUP BY [tblOFCTRKG].ID,
[tblOFCTRKG].[DOC ID], [tblOFCTRKG].[DOC NAME], [tblOFCTRKG].[DOC PH],
[tblOFCTRKG].[DOC FX], [tblOFCTRKG].[DOC ADD], [tblOFCTRKG].[DOC ADD2],
[tblOFCTRKG].[DOC CITY], tblOFCTRKG].St, [tblOFCTRKG].[DOC CNTY],
[tblOFCTRKG].ID HAVING ((([tblOFCTRKG].[DOC CNTY])=[forms]![frm DOC
Tracking]![PickCounty])) ORDER BY [tblOFCTRKG].[DOC NAME], [tblOFCTRKG].[DOC
PH];
How can I get the Doc list to list the doc from the selection of Combo Box
1? I have tried everything I can. I would appreciate any help please.
Thank you.
Option Group consisting of 3 choices: Counties, Cities, Companies. 2 combo
boxes. Combo box 1 - List the names of the choice picked from the Option
Group. Combo Box 2 - should list the doctors in the choice selected from
Combox box 1. That is my problem. I can't get the Combo box 2 to work.
Below is the code for After Update in the Option Group.
Private Sub optsearch_AfterUpdate()
Dim strRowSource As String
Select Case Me.optsearch
Case 1 'County
strRowSource = "SELECT [qry Counties].[CNTY] FROM [qry Counties]"
Case 2 'City
strRowSource = "SELECT [qry Cities].[City] FROM [qry Cities]"
Case 3 'Group
strRowSource = "SELECT [qry Groups].[Company] FROM [qry Groups]"
End Select
Me.PickCounty.RowSource = strRowSource
End Sub
This is the SQL for Combo Box 2 (DOC List)
SELECT DISTINCT [tblOFCTRKG].ID, [tblOFCTRKG].[DOC ID], [tblOFCTRKG].[DOC
NAME], [tblOFCTRKG].[DOC PH], [tblOFCTRKG].[DOC FX], [tblOFCTRKG].[DOC ADD],
[tblOFCTRKG].[DOC ADD2], [tblOFCTRKG].[DOC CITY], [tblOFCTRKG].St,
[tblOFCTRKG].[DOC CNTY] FROM [tblOFCTRKG] GROUP BY [tblOFCTRKG].ID,
[tblOFCTRKG].[DOC ID], [tblOFCTRKG].[DOC NAME], [tblOFCTRKG].[DOC PH],
[tblOFCTRKG].[DOC FX], [tblOFCTRKG].[DOC ADD], [tblOFCTRKG].[DOC ADD2],
[tblOFCTRKG].[DOC CITY], tblOFCTRKG].St, [tblOFCTRKG].[DOC CNTY],
[tblOFCTRKG].ID HAVING ((([tblOFCTRKG].[DOC CNTY])=[forms]![frm DOC
Tracking]![PickCounty])) ORDER BY [tblOFCTRKG].[DOC NAME], [tblOFCTRKG].[DOC
PH];
How can I get the Doc list to list the doc from the selection of Combo Box
1? I have tried everything I can. I would appreciate any help please.
Thank you.