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.
 

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