Printing Labels?

Fides

Registered User.
Local time
Today, 06:58
Joined
Jul 17, 2012
Messages
23
I'm trying to print a label from within a form I'm using the following code but some how it doesn't select the right record to print.

Code:
Private Sub cmdLabelPrint_Click()

On Error GoTo error
If MsgBox("Verbind de DYMO 400 printer voordat je door gaat!", vbOKCancel + vbInformation, "DYMO Labels Printen") = vbCancel Then Exit Sub
Set Application.Printer = Application.Printers("DYMO LabelWriter 400")
    DoCmd.OpenReport "rptLabels Dymo", acPreview, , "tblOverige.ID= " & Me.ID
Exit Sub
error:
MsgBox "Deze knop werkt alleen met de standaard DYMO LabelWriter 400 printer!", vbOKOnly + vbCritical, "Fout :("

End Sub
 
What is the data type of ID? And there's a space after ID=
 
It's an auto number. And yes I know of the space.
I found out it uses the ID from an other table while it clearly is pointing to the Overige table as seen in the code. Why doesn't it 'listen'?
 
So get rid of the space and run the code again. You're saying that the Record Source of your report is linked up to more than one table?

If you're not having any joy, upload a stripped down version of your db and I'll take a quick look.
 
In the Query I switched the two ID fields around and put the Overige ID field first, then it works.
 

Users who are viewing this thread

Back
Top Bottom