what is wrong with my DoCmd syntax?

R

Robert

DoCmd.PrintOut ([PrintRange As AcPrintRange
=acSelection,[PageFrom],[Pageto])

I wrote a macro attached to a command button to open a certain form, which
it does, but i then wrote this in the event procedure trying to force the
command button to prompt the user to input which page of the form to start
printing and which page to stop.
 
J

John Nurick

Hi Robert,

From your description I think you need something like this:

Dim FirstPage As Long
Dim LastPage As Long

FirstPage = InputBox("First page to print:")
LastPage = InputBox("Last page to print:")

DoCmd.Printout acSelection, FirstPage, LastPage

DoCmd.PrintOut ([PrintRange As AcPrintRange
=acSelection,[PageFrom],[Pageto])

I wrote a macro attached to a command button to open a certain form, which
it does, but i then wrote this in the event procedure trying to force the
command button to prompt the user to input which page of the form to start
printing and which page to stop.
 
R

Robert

John,
Thank you sir. I will edit my text and let you know how this works. Have a
great day.
Robert

John Nurick said:
Hi Robert,

From your description I think you need something like this:

Dim FirstPage As Long
Dim LastPage As Long

FirstPage = InputBox("First page to print:")
LastPage = InputBox("Last page to print:")

DoCmd.Printout acSelection, FirstPage, LastPage

DoCmd.PrintOut ([PrintRange As AcPrintRange
=acSelection,[PageFrom],[Pageto])

I wrote a macro attached to a command button to open a certain form, which
it does, but i then wrote this in the event procedure trying to force the
command button to prompt the user to input which page of the form to start
printing and which page to stop.
 
Top