Printout line

A

albycindy

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!
 
A

albycindy

I knew it was easy! (well? everyone else says it!!!)

Thank you thank you thank you!
 
Top