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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wherecondition argument to open Report

Status
Not open for further replies.

ecugrad

MIS
Apr 17, 2001
191
US
Question. I have two combo boxes named Quarter and Dept. I'm trying to use the selections of the above to open a report using the WhereCondition argument. Can somebody tell me where I'm going wroung with the code below. The Me.Quarter but the Me.Dept does not..

If Me.Quarter = "qtr12002" Then
DoCmd.OpenReport "rptqtr12002", acViewPreview, wherecondition:="Section" = Me.Dept

Thanks
MF
 
Figured it out, Thanks...

If Me.Quarter = "qtr12002" Then
DoCmd.OpenReport "rptqtr12002", acViewPreview, wherecondition:="Section = Forms![frmDataAdministration]![Dept]"
 
I believe lots of places. You are attempting to use a single named parameter 'WhereCondition:=' when there are really three parameters. Access does not work that way. You can use named parameters only if ALL the parameters are named, so your 'rptqty12002' and acViewPreview would also need to be named. Then, you WhereCondition parameter has at least two errors. First, the equal sign need to be inside the quotes and second, you need to place the Me.Dept inside quotes since it is text.

WhereCondition:="Section = '" & Me.Dept & "'" ----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top