Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Parameters based on a form for a report

Status
Not open for further replies.

scoobypaw

Technical User
Jun 8, 2005
20
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top