Access printing?

A

alex

Experts,

I've created a quick report card based on an Access Form.

It works well until I have to print multiple records. I've added the
following VBA code to an on click command:

Private Sub LNR_REFERRAL_Click()
On Error GoTo Err_LNR_REFERRAL_Click

DoCmd.PrintOut acPages, 1, 1, acMedium, 1, 1

Exit_LNR_REFERRAL_Click:
Exit Sub

Err_LNR_REFERRAL_Click:
MsgBox Err.Description
Resume Exit_LNR_REFERRAL_Click
End Sub

After the data is entered on the Form, the user checks a box (on the
Form) and the 'report' is created-which is simply a snapshot of what
was entered on the screen.

This works very well; however, when the user saves the record (data is
transmitted to the table), then enters new data onto the Form, then
prints, the aforementioned code prints the data that was previously
entered and not what is currently on the Form.

Can someone help adjust the code so that the current screen is printed
and not what was previously saved? The above code will print what's
on the current screen until you enter a new record.

Thanks,
alex
 
G

Guest

Alex,
You should have a Me.Refresh before your code to print. Why are you
printing a form instead of a report?
 
G

Guest

Hey Alex,
If your form is directly tied to your table and you are printing out the
form info in the same format as the form, why not...

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

....as a button on the form.
This will just print the current record.
HTH
 
A

alex

Hey Alex,
If your form is directly tied to your table and you are printing out the
form info in the same format as the form, why not...

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

...as a button on the form.
This will just print the current record.
HTH
Thanks Joe. Your code works.

However, now that we're using acSelection, I'm getting multiple pages,
i.e., junk around the Form that I don't want.
Is there any way to use acSelection, and not acPages, and only print
one page?
 
G

Guest

Hey Alex,
However, now that we're using acSelection, I'm getting multiple pages, i.e.,
junk around the Form that I don't want.
My only suggestion would be to check it out in print preview, reset margins
and try getting your form to fit on one page...not sure what you mean by
junk, extra fields you don't want to see? lines? Think about the print
preview thing and re-design the form...
/*begin rant*/
.... and don't pay too much attention to people that want to complain about
printing from forms, if printing from forms is so 'undesirable' then why did
Microsoft write the program to do it?
/*rant complete*/
BTW, I like printing from forms and personally don't see the sense in
creating more code for a form that shows exactly what a form does.
Let me know if that helps,
Joe
 
A

alex

Hey Alex,
However, now that we're using acSelection, I'm getting multiple pages, i.e.,
junk around the Form that I don't want.
My only suggestion would be to check it out in print preview, reset margins
and try getting your form to fit on one page...not sure what you mean by
junk, extra fields you don't want to see? lines? Think about the print
preview thing and re-design the form...
/*begin rant*/
... and don't pay too much attention to people that want to complain about
printing from forms, if printing from forms is so 'undesirable' then why did
Microsoft write the program to do it?
/*rant complete*/
BTW, I like printing from forms and personally don't see the sense in
creating more code for a form that shows exactly what a form does.
Let me know if that helps,
Joe

Joe,

The 'junk' would be some of my command buttons at the bottom.

I started foolin' around with the margins and the form size itself; I
think it will work.

Thanks again for the time.

alex
 
G

Guest

Ah yes, buttons...in your forms design view go into the properties of the
buttons and about 12 lines down you'll see "Display When", choose "Screen
Only", that way they show up nicely on the screen and not the printout.
 

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