Printing a single Label in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was advised earlier inorder to print a single label in Access. I would
creat a new command button on a form and add this line to the command button
but I get an error message. Can anyone tell me what is wrong.

Private Sub Command89_Click()
On Error GoTo Err_Command89_Click

stDocName = "LabelsCustomerInvoices"

Me.Refresh

DoCmd.OpenReport "LabelsCustomerInvoices", acViewPreview, , "id = " & Me.id
 
You don't mention what the error message is.

A few things:

Try

Me.Refresh
DoCmd.OpenReport "LabelsCustomerInvoices", acViewPreview, , "id = " & Me.id

The above is all the code you need.

Also, does the above code compile BEFORE you try and run it?

Also, what is the name of the primary key field you used to identify each
record. (normally, the default is "id").

So, try:
Me.Refresh
DoCmd.OpenReport "LabelsCustomerInvoices", acViewPreview, , "id = " & Me!id

Note how I have suggested to try

me!ID

Also, replace "id" with the name of the key id that you have. So, if you use
AccountNumber, then:

"AccountNumber = " & me!AccountNumber

And, note that if accountnumber is a TEXT field, then you must surround this
with quotes like:

"AccountNumber = '" & me!AccountNumber & "'"
 

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

Similar Threads

Help on printing single mailing label???Please 5
Subreport - current year 1
Report Missing Data 2
Report printing 1
Report printing 15
Printing from a form 2
Report printing problem 2
Sending Email in txt format 10

Back
Top