I just cannot seem to grasp the proper way to use quotes. Now, I want to filter a report and display results based on a timeframe chosen by the user.
=====================================
stDocName = "rptFollowup"
stSelectTech = "Tech='" & Forms![frmTechnician]![cboTechnician] & "'"
Select Case Frame10
Case 1
stTimeframe = "<" & Date
Case 2
stTimeframe = Date
Case 3
stTimeframe = ">=" & Date And "< " & DateAdd(d, 8, Date)
Case 4
stTimeframe = ">=" & Date And "<" & DateAdd(m, 1, Date)
End Select
Me.Visible = False
If stSelectTech = "Tech='All Technicians'" Then
DoCmd.OpenReport stDocName, acViewPreview
Else
DoCmd.OpenReport stDocName, acViewPreview, stSelectTech, "[Followup] = " & stTimeframe
End If
==============================
In Case 1, I get error 3075 (syntax/missing operator).
In Case 2, I don't get an error but that might be because there's no data fitting that selection.
In Cases 3 and 4, I get error 5 (invalid procedure call or argument).
I hope I didn't bite off more than I can chew. I'll appreciate any advice you can give me.
=====================================
stDocName = "rptFollowup"
stSelectTech = "Tech='" & Forms![frmTechnician]![cboTechnician] & "'"
Select Case Frame10
Case 1
stTimeframe = "<" & Date
Case 2
stTimeframe = Date
Case 3
stTimeframe = ">=" & Date And "< " & DateAdd(d, 8, Date)
Case 4
stTimeframe = ">=" & Date And "<" & DateAdd(m, 1, Date)
End Select
Me.Visible = False
If stSelectTech = "Tech='All Technicians'" Then
DoCmd.OpenReport stDocName, acViewPreview
Else
DoCmd.OpenReport stDocName, acViewPreview, stSelectTech, "[Followup] = " & stTimeframe
End If
==============================
In Case 1, I get error 3075 (syntax/missing operator).
In Case 2, I don't get an error but that might be because there's no data fitting that selection.
In Cases 3 and 4, I get error 5 (invalid procedure call or argument).
I hope I didn't bite off more than I can chew. I'll appreciate any advice you can give me.