I'm new at this stuff, so bare with me.
I have a main form which displays a client record.
The main form has 2 subforms. The first subform has a list of Cases.
The Second subform is a list of Tasks.
My intent is this: When I click on a button next to one of the Case
records (in the first subform), I want the list of Tasks (the second
subform) to display only those records (tasks) associated with the Case
which was just selected.
Here is what I have attempted:
Private Sub View_Tasks_Clic k()
On Error GoTo Err_View_Tasks_ Click
GBL_String = Case_or_Issue
strSQL = "Select * from Task_List where"
strSQL = strSQL & " " & Case_or_Issue & " =" & GBL_String
Forms!Case_List _By_Clients!Tas k_List.Form.Rec ordSource = strSQL
Exit_View_Tasks _Click:
Exit Sub
Err_View_Tasks_ Click:
MsgBox Err.Description
Resume Exit_View_Tasks _Click
End Sub
Note: The Case_or_Issue that is used to assign a value to GBL_String
identifies the record selected from the first subform. My Task_List
(second subform) also has a field called Case_or_Issue. So I am trying
to compare the two strings and filter the form accordingly.
When I try this, I get "Syntax error (missing operator) in query
expression"
While trouble shooting, I removed the second part of strSQL, and
removed "where" from the first part, so as to just select all records.
This produces no errors.
Can someone help me understand how to solve this error?
Thank You,
Jody Blau
I have a main form which displays a client record.
The main form has 2 subforms. The first subform has a list of Cases.
The Second subform is a list of Tasks.
My intent is this: When I click on a button next to one of the Case
records (in the first subform), I want the list of Tasks (the second
subform) to display only those records (tasks) associated with the Case
which was just selected.
Here is what I have attempted:
Private Sub View_Tasks_Clic k()
On Error GoTo Err_View_Tasks_ Click
GBL_String = Case_or_Issue
strSQL = "Select * from Task_List where"
strSQL = strSQL & " " & Case_or_Issue & " =" & GBL_String
Forms!Case_List _By_Clients!Tas k_List.Form.Rec ordSource = strSQL
Exit_View_Tasks _Click:
Exit Sub
Err_View_Tasks_ Click:
MsgBox Err.Description
Resume Exit_View_Tasks _Click
End Sub
Note: The Case_or_Issue that is used to assign a value to GBL_String
identifies the record selected from the first subform. My Task_List
(second subform) also has a field called Case_or_Issue. So I am trying
to compare the two strings and filter the form accordingly.
When I try this, I get "Syntax error (missing operator) in query
expression"
While trouble shooting, I removed the second part of strSQL, and
removed "where" from the first part, so as to just select all records.
This produces no errors.
Can someone help me understand how to solve this error?
Thank You,
Jody Blau
Comment