I'm using the DoCmd.OpenReport method. A portion of my code looks like this:
Dim ReportName, DateFieldName, CatCriteria
DateFieldName = "DelivDate"
ReportName = "rptInvoices"
CatCriteria = "meat > 0"
DoCmd.OpenReport _
ReportName:=ReportName, _
view:=Me.OutputMode, _
wherecondition:=DateFieldName & " Between #" & _
Me.StartDate & "# AND #" & _
Me.EndDate & "#" And "& CatCriteria"
When I try to run the code I get a Type Mismatch error. If I run the code with either of the expressions it runs fine, the problem exists when I combine the 2 expressions. I know it must be a problem with my syntax, but I can't figure it out. Can anyone please help me ? CatCriteria is a field type number and obviously DelivDate is a field type date. Me.StartDate and Me.EndDate are unbound controls on a form that the user supplies dates to. What I am trying to do is select invoices between certain dates when a specified field is > 0.
Thanks for any help offered.
Dim ReportName, DateFieldName, CatCriteria
DateFieldName = "DelivDate"
ReportName = "rptInvoices"
CatCriteria = "meat > 0"
DoCmd.OpenReport _
ReportName:=ReportName, _
view:=Me.OutputMode, _
wherecondition:=DateFieldName & " Between #" & _
Me.StartDate & "# AND #" & _
Me.EndDate & "#" And "& CatCriteria"
When I try to run the code I get a Type Mismatch error. If I run the code with either of the expressions it runs fine, the problem exists when I combine the 2 expressions. I know it must be a problem with my syntax, but I can't figure it out. Can anyone please help me ? CatCriteria is a field type number and obviously DelivDate is a field type date. Me.StartDate and Me.EndDate are unbound controls on a form that the user supplies dates to. What I am trying to do is select invoices between certain dates when a specified field is > 0.
Thanks for any help offered.