Getting report to open with where clause

oli82

Registered User.
Local time
Today, 08:49
Joined
Jan 10, 2008
Messages
54
Hi,

Small question, I am trying to query a report so that when it opens up it only opens a specific copywrite holder.

To start I have an unbound form with a combo box from which a person selects a copyright holder. This combo box is "SelCopyReq". Then I run some script on a go button below:

Private Sub Command2_Click()
DoCmd.OpenReport "R_Requested", acViewPreview, , "[Copyright] = '" & "SelCopyReq" & "'"
End Sub

Where Copyright is the field in the report that I want to select.

For example in the combo box I select Penguin books, I press go and would like all requests for the copyright holder Penguin books to be reported.

This is the first time I have used this in Reports but have done it many times in forms.

Thanks for the help.
Oliver
 
Your DoCmd is broken. Change this:

DoCmd.OpenReport "R_Requested", acViewPreview, , "[Copyright] = '" & "SelCopyReq" & "'"

To This:

DoCmd.OpenReport "R_Requested", acViewPreview, , "[Copyright] = '" & SelCopyReq & "'"

(You had too many quotes.)
 
Thanks very much - must be friday :)
 

Users who are viewing this thread

Back
Top Bottom