Problems with the DoCmd.OpenReport command
Posted on 2014-01-16
I'm trying to run a report generating mailing labels. Here's what I have:
strCurrentYear = "Table1.[Dues '" & Format(Now(), "yy") & "]"
strSQL = strCurrentYear & "<> 0 " & "AND Membership Type = JUNIOR"
DoCmd.OpenReport "5160(small) Jr membership labels", acViewPreview, , "strSQL"
strCurrentYear becomes Due '14
I have a query that has name and address as selected fields from the main table and is associated with the main table in the query properties. I want to have 4 type of mailing labels:
All big labels
All small labels
Juniors big labels
juniors small labels
The only difference is parsing for the membership type.
When I run this I get a prompt for strSQL. If I take off the quotes around strSQL in the DoCmd I get an error.
I've tried a number of things to get it to work. I've even put "Dues '14" in place of strSQL for the DoCmd and get an error.
Need some direction to straighten me out.