print a record in form view

  • Thread starter event procedure for a click event
  • Start date
E

event procedure for a click event

I am building a form and have inserted an event procedure to have the form
print one record at a time and it will only print a blank piece of paper.
This is my code, can anyone tell me what they think is wrong? Any help is
greatly appreciated.

rivate Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click


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

Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click

End Sub
 
M

missinglinq via AccessMonster.com

Assuming that the line

rivate Sub cmdPrint_Click()

is only missing the *P* in Private because of a copying mistake, and the
actual code reads

Private Sub cmdPrint_Click()

I don't know! The code works fine for me, regardless of the type of form used,
unless the record with focus was blank. What type of form are you using?
Single View, Continuous or Datasheet?
 
E

event procedure for a click event

Thank you and you're right, it was just a copying mistake. I had created a
different database and this was the code I used in that one to actually have
a copy of the form print out. When I inserted this code into my new database
form it just prints a blank sheet of paper. I did add test data and it did
print the actual record but not the form it was in (meaning no lables - it
was just a bunch of Xs and comments on a blank piece of paper that made no
sense). I'm having a hard time figuring out why it would print a blank form
in one database and a blank sheet of paper in another database. Thank you
for your help, though, it's appreciated.
 
E

event procedure for a click event

I just want everyone to know I FINALLY found my error. In the page setup
feature I had the box to print data only checked. After I unchecked it, my
form printed by the code shown below. Thanks for all your help.
 

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