G
Guest
I am attempting to open a form by passing 2 values to the query that the form
is based off of. If I remove the end part of the statement it runs fine, but
if I try and attach the second part it gives me a type mismatch. Here is the
code I have:
Dim strPara As String
If chkWeekly.Value = True Then
strPara = "[Query_by_Date]![Date]>='" & txtStartDate & "'" And
strPara = "[Query_by_Date]![Date]<='" & txtEndDate & "'"
DoCmd.OpenForm "Query_by_Date_Weekly_Form", acViewNormal, , strPara
Else
strPara = "[Query_by_Date]![Date]>='" & txtStartDate & "'" And
strPara = "[Query_by_Date]![Date]<='" & txtEndDate & "'"
DoCmd.OpenForm "Monthly_by_Date_Form", acViewNormal, , strPara
End If
(sorry for how it looks)
Basically I am trying to pull up a form via a query based on whether the
criteria falls in between the date ranges (txtStartDate and txtEndDate). I
know its throwing the error on everything after the And in this part of the
code:
strPara = "[Query_by_Date]![Date]>='" & txtStartDate & "'" And strPara =
"[Query_by_Date]![Date]<='" & txtEndDate & "'"
Any help is greatly appreciated.
C_Ascheman
is based off of. If I remove the end part of the statement it runs fine, but
if I try and attach the second part it gives me a type mismatch. Here is the
code I have:
Dim strPara As String
If chkWeekly.Value = True Then
strPara = "[Query_by_Date]![Date]>='" & txtStartDate & "'" And
strPara = "[Query_by_Date]![Date]<='" & txtEndDate & "'"
DoCmd.OpenForm "Query_by_Date_Weekly_Form", acViewNormal, , strPara
Else
strPara = "[Query_by_Date]![Date]>='" & txtStartDate & "'" And
strPara = "[Query_by_Date]![Date]<='" & txtEndDate & "'"
DoCmd.OpenForm "Monthly_by_Date_Form", acViewNormal, , strPara
End If
(sorry for how it looks)
Basically I am trying to pull up a form via a query based on whether the
criteria falls in between the date ranges (txtStartDate and txtEndDate). I
know its throwing the error on everything after the And in this part of the
code:
strPara = "[Query_by_Date]![Date]>='" & txtStartDate & "'" And strPara =
"[Query_by_Date]![Date]<='" & txtEndDate & "'"
Any help is greatly appreciated.
C_Ascheman