Printout line

G

Guest

What is wrong with this line? VBA keeps telling me there is a compile error
or it expects something (=)

DoCmd.PrintOut(acPrintAll, , , ,2,-1)

Within the code...

Private Sub Report_Open(Cancel As Integer)
Collection = MsgBox("Do you wish to print these collection _
notes?",vbOKCancel, "Print") = vbOK
If Collection = vbOK Then
DoCmd.PrintOut(acPrintAll, , , ,2,-1)
Else
End Sub
End If

I have redone and redone this with no success. If I leave the PrintOut
conditions to simply (acPrintAll) there is no problem. I have checked the
number of commas over and over again. I need two copies of each page that
will print out after each other, ie, page 1, page 1, page 2, page 2 etc

TIA
 
D

Douglas J Steele

Remove the parentheses in your DoCmd.PrintOut statement. The PrintOut method
doesn't use them.
 
O

OfficeDev18 via AccessMonster.com

You need to twek your code as follows:

Collection = MsgBox("Do you wish to print these collection " _
& "notes?",vbOKCancel, "Print")

That is, fix the end of the first line and the beginning of the second line
of the statement, and get rid of the "=VbOK" at the end of the second line.

Should work fine!
 
O

OfficeDev18 via AccessMonster.com

You need to tweak your code as follows:

Collection = MsgBox("Do you wish to print these collection " _
& "notes?",vbOKCancel, "Print")

That is, fix the end of the first line and the beginning of the second line
of the statement, and get rid of the "=VbOK" at the end of the second line.

Should work fine!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top