Printing from a form

O

Orlan

I have a form with two control buttons. One sends an email based on the form,
the other prints a label based on the form, controled by an autonumber ID on
the form. In the past this has always worked for me, but now it won't print
the label (the label is blank). If I choose the menu Record, Refresh, it
works correctly.

Using requery or Save in the coding prior to printing doesn't do it.

Any thing else I can try?

coding on the button is:

Private Sub cmdPrintLabels_Click()
On Error GoTo Err_cmdPrintLabels_Click

Dim stDocName As String

stDocName = "lblStoreLabel"
DoCmd.OpenReport stDocName, acViewPreview, , "[ID] =
Forms!frmAddRecievingEmail![ID]"
'DoCmd.OpenReport stDocName, acViewNormal, , "[ID] =
Forms!frmAddRecievingEmail![ID]"
Exit_cmdPrintLabels_Click:
Exit Sub

Err_cmdPrintLabels_Click:
MsgBox Err.Description
Resume Exit_cmdPrintLabels_Click

End Sub
 
J

John W. Vinson

I have a form with two control buttons. One sends an email based on the form,
the other prints a label based on the form, controled by an autonumber ID on
the form. In the past this has always worked for me, but now it won't print
the label (the label is blank). If I choose the menu Record, Refresh, it
works correctly.

Using requery or Save in the coding prior to printing doesn't do it.

Any thing else I can try?
coding on the button is:

Try putting a line in the code to explicitlly save the record before the
OpenReport line:

DoCmd.RunCommand acCmdSaveRecord
 
O

Orlan

Thanks, that worked


John W. Vinson said:
Try putting a line in the code to explicitlly save the record before the
OpenReport line:

DoCmd.RunCommand acCmdSaveRecord
 

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