Hi
I have a command button in a form which opens a report from a query i created based on parameter dates entered within my form. I recently changed the date field in my query to another date field as the report was using the wrong date. Since i changed this date in my query along with updating the control source in my report, I am getting the following error message.
Syntax error (missing operator) in query expression '( F4_Date receipt of authorisation >= #04/01/2009# And F4_Date receipt of authorisation <= #04/23/2009#)'.
My query runs fine on it`s own and so does my report. It`s just the form command button that generates this error message. The following code i`m using for my command button is: (The red bit indicates the new date field i am using in my query)
Private Sub AgeGroup_Click()
On Error GoTo Err_AgeGroup_Click
Dim stDocName As String
Dim strWhere As String
strWhere = " F4_Date receipt of authorisation >= #" & Format(FromDate, "MM/DD/YYYY") & "#" & _
" And F4_Date receipt of authorisation <= #" & Format(ToDate, "MM/DD/YYYY") & "#"
stDocName = "Rpt_AgeGroup"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_AgeGroup_Click:
Exit Sub
Err_AgeGroup_Click:
MsgBox Err.Description
Resume Exit_AgeGroup_Click
End Sub
Prior to changing this date in my query it was all working fine.
If this makes no sense, i`d be happy to email screen prints of bits if easier.
thanks
I have a command button in a form which opens a report from a query i created based on parameter dates entered within my form. I recently changed the date field in my query to another date field as the report was using the wrong date. Since i changed this date in my query along with updating the control source in my report, I am getting the following error message.
Syntax error (missing operator) in query expression '( F4_Date receipt of authorisation >= #04/01/2009# And F4_Date receipt of authorisation <= #04/23/2009#)'.
My query runs fine on it`s own and so does my report. It`s just the form command button that generates this error message. The following code i`m using for my command button is: (The red bit indicates the new date field i am using in my query)
Private Sub AgeGroup_Click()
On Error GoTo Err_AgeGroup_Click
Dim stDocName As String
Dim strWhere As String
strWhere = " F4_Date receipt of authorisation >= #" & Format(FromDate, "MM/DD/YYYY") & "#" & _
" And F4_Date receipt of authorisation <= #" & Format(ToDate, "MM/DD/YYYY") & "#"
stDocName = "Rpt_AgeGroup"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_AgeGroup_Click:
Exit Sub
Err_AgeGroup_Click:
MsgBox Err.Description
Resume Exit_AgeGroup_Click
End Sub
Prior to changing this date in my query it was all working fine.
If this makes no sense, i`d be happy to email screen prints of bits if easier.
thanks