Hello,
I have created a form that opens a report based on the parameters I choose in the form.
I got the first parameter to work on it's own "Head Office" , but I can't seems to get the date range part to work.
FYI - I gives me this error: Syntax error (missing operator)in queary expression '([Head Office]='Cheryl Pope'[BeginningDate]='6/1/05'[EndingDate]=6/20/05')'
Here is what I have:
Private Sub btnOpen_Click()
On Error GoTo Err_btnOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptLetterApprovalAllbyHeadofOffice"
stLinkCriteria = "[Head Office]=" & "'" & Me![Head Office] & "'" & "[BeginningDate]=" & "'" & Me![BeginningDate] & "'" & "[EndingDate]=" & "'" & Me![EndingDate] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
DoCmd.Close acForm, "frmHeadofOfficeSelectorbyDateRange", acSaveNo
Exit_btnOpen_Click:
Exit Sub
Err_btnOpen_Click:
MsgBox Err.Description
Resume Exit_btnOpen_Click
End Sub
I have created a form that opens a report based on the parameters I choose in the form.
I got the first parameter to work on it's own "Head Office" , but I can't seems to get the date range part to work.
FYI - I gives me this error: Syntax error (missing operator)in queary expression '([Head Office]='Cheryl Pope'[BeginningDate]='6/1/05'[EndingDate]=6/20/05')'
Here is what I have:
Private Sub btnOpen_Click()
On Error GoTo Err_btnOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptLetterApprovalAllbyHeadofOffice"
stLinkCriteria = "[Head Office]=" & "'" & Me![Head Office] & "'" & "[BeginningDate]=" & "'" & Me![BeginningDate] & "'" & "[EndingDate]=" & "'" & Me![EndingDate] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
DoCmd.Close acForm, "frmHeadofOfficeSelectorbyDateRange", acSaveNo
Exit_btnOpen_Click:
Exit Sub
Err_btnOpen_Click:
MsgBox Err.Description
Resume Exit_btnOpen_Click
End Sub