Control for printing report on form?

G

Guest

Hi,

I have a detailed 2-page report that is based on a 2 page form. As it is set
up now the user fills out the form, closes it out and opens a query which
asks the user to select the record just filled out from a drop down of all
available records. After making a selection the report based on the record is
displayed in Print Preview format.

Is there a way I can place a control button at the bottom of the original
form so that once all the information is filled in the user can simply click
on the button which will take the user directly to the Print Preview for that
record without having to go through all the other steps detailed above?

Also, if the above is possible is there additionally some way there can be
some kind of control on the Print Preview the user can click if he/she finds
there's a mistake in the Print Preview and he/she wishes to return to the
original form to make corrections?

Thanks
David
 
T

tina

you can add a command button to the form, with the following code in the
Click event procedure, as

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acViewPreview, , _
"PrimaryKeyField = " & Me!PrimaryKeyField

substitute the correct names of the report and the primary key field, of
course. and make sure that the table's primary key field is included in the
report's RecordSource. if the primary key is alpha rather than numeric, the
syntax would be

DoCmd.OpenReport "ReportName", acViewPreview, , _
"PrimaryKeyField = '" & Me!PrimaryKeyField & "'"

to go back to the form, just close the report window.

hth
 

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