Hi Everyone,
I am using Access 2003 to input 2 dates from text boxes to display a report. The following is the code I'm trying to run:
However, when I attempt to run it it gives me this error:
syntax error(missing operator) in query expression '(AND CAConfirmationD ate BETWEEN #12/12/2000# AND #12/12/2005
Anyone have any idea what would work? Thanks
-Todd
I am using Access 2003 to input 2 dates from text boxes to display a report. The following is the code I'm trying to run:
Code:
Dim fromDate As Date
Dim toDate As Date
Dim BusProgIDs As String
Dim IncAllOpen As Boolean
Dim strWhere As String
Dim ctl As control
Dim i As Integer
If ckAllOpen.Value = True Then
IncAllOpen = True
Else
IncAllOpen = False
End If
If lstBusinessProgramsPF.ListIndex > 0 Then
Set ctl = lstBusinessProgramsPF
fromDate = Format(txtFromProdFail.Value, "mm/dd/yyyy")
toDate = Format(txtToProdDate.Value, "mm/dd/yyyy")
BusProgIDs = GetSqlBusinessProgram(ctl)
strWhere = ""
strWhere = strWhere & BusProgIDs
strWhere = strWhere & " AND CAConfirmationDate BETWEEN #" & fromDate & "# AND #" & toDate & "#"
If IncAllOpen = True Then
strWhere = strWhere & " OR (" & BusProgIDs
strWhere = strWhere & " AND (CAConfirmationDate Is NULL)"
strWhere = strWhere & " AND (OpeningDate <= #" & toDate & "#))"
End If
DoCmd.OpenReport "ProgressReport", acViewPreview, , strWhere, , (fromDate & "," & toDate)
Else
MsgBox "One or more Business Programs must be selected to view a report.", vbOKOnly
End If
syntax error(missing operator) in query expression '(AND CAConfirmationD ate BETWEEN #12/12/2000# AND #12/12/2005
Anyone have any idea what would work? Thanks
-Todd
Comment