A
Afrosheen via AccessMonster.com
I have a form with a group box on it. The code for it is:
20 Select Case grpPlan.Value
Case 1
30 strMon = "WorkRec"
40 Case 2
50 strMon = "IntRec"
60 Case 3
70 strMon = "FinalRec"
80 End Select
After I select the one I want then the SQL is build based on the selection
and a report is generated.
strWhere = "EmpSuper.WorkRec=""" & strMon & _
""" or EmpSuper.IntRec=""" & strMon & _
""" or EmpSuper.FinalRec=""" & strMon & """"
30 stDocName = "rptTapsDueRec"
40 DoCmd.OpenReport stDocName, acPreview, , strWhere, , strMon
I know the group "strMon" is a string..
The thing is the actual fields are date fields.
What I'm trying to accomplish is when I select the group it will give a
report with the dates that are in the field. Some of the records have them.
Some do not.
When I did the debug.print strWhere it showed:
EmpSuper.WorkRec="WorkRec" or EmpSuper.IntRec="WorkRec" or EmpSuper.
FinalRec="WorkRec"
In this case the strWhere is correct. I just don't know how to write the SQL
for dates.
When I ran the report it gave me a data type mismatch.
As always, thanks for your help and thanks for reading this post.
20 Select Case grpPlan.Value
Case 1
30 strMon = "WorkRec"
40 Case 2
50 strMon = "IntRec"
60 Case 3
70 strMon = "FinalRec"
80 End Select
After I select the one I want then the SQL is build based on the selection
and a report is generated.
strWhere = "EmpSuper.WorkRec=""" & strMon & _
""" or EmpSuper.IntRec=""" & strMon & _
""" or EmpSuper.FinalRec=""" & strMon & """"
30 stDocName = "rptTapsDueRec"
40 DoCmd.OpenReport stDocName, acPreview, , strWhere, , strMon
I know the group "strMon" is a string..
The thing is the actual fields are date fields.
What I'm trying to accomplish is when I select the group it will give a
report with the dates that are in the field. Some of the records have them.
Some do not.
When I did the debug.print strWhere it showed:
EmpSuper.WorkRec="WorkRec" or EmpSuper.IntRec="WorkRec" or EmpSuper.
FinalRec="WorkRec"
In this case the strWhere is correct. I just don't know how to write the SQL
for dates.
When I ran the report it gave me a data type mismatch.
As always, thanks for your help and thanks for reading this post.