Label run.
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Label run.
I need to print some labels, the data is in a table.
As i loop through the table, i need to check a value in the table to determine if to print it or not. (its a yes/no field)
The labels, are stored as a report. and there are 3 fields on the report.
something like
DoCmd.RunSQL "INSERT INTO tblCustomerLabels " & "SELECT * " & "FROM Customers" ??
As i loop through the table, i need to check a value in the table to determine if to print it or not. (its a yes/no field)
The labels, are stored as a report. and there are 3 fields on the report.
something like
DoCmd.RunSQL "INSERT INTO tblCustomerLabels " & "SELECT * " & "FROM Customers" ??
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Label run.
Create a query based on the table that selects only the records where the Yes/No field is True.
Use this query as record source for the label report.
Or, if you want to be able to run the report with all records too, leave its record source set to the table, and open the report from a command button on a form:
Substitute the correct names.
If you want to print directly, change acViewPreview to acViewNormal.
Use this query as record source for the label report.
Or, if you want to be able to run the report with all records too, leave its record source set to the table, and open the report from a command button on a form:
Code: Select all
Private Sub cmdReport_Click()
On Error GoTo ErrHandler
DoCmd.OpenReport "rptLabelReport", acViewPreview, , "[YesNoField]=True"
Exit Sub
ErrHandler:
If Err <> 2501 Then
MsgBox Err.Description, vbExclamation
End If
End Sub
If you want to print directly, change acViewPreview to acViewNormal.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
Thanks Hans.. will give it a crack!
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
Its currently only printing the first label.
also.. is there a way to enforce a particular printer? it IS printing to the label printer.. or, is that set up as part of the design of the report?
for the other printing that i have going on , for different labels.. i'm using
also.. is there a way to enforce a particular printer? it IS printing to the label printer.. or, is that set up as part of the design of the report?
for the other printing that i have going on , for different labels.. i'm using
Code: Select all
DoCmd.OpenReport "Main_Label", acViewPreview, , , acHidden
Set Application.Printer = Application.Printers(ChosenPrinter)
DoCmd.SelectObject acReport, "Main_Label"
DoCmd.PrintOut acSelection
DoCmd.Close acReport, "Main_Label"
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Label run.
If possible, set the printer to be used in the design of the report (Page Setup tab of the ribbon > Page Setup button > Page tab of the dialogue).
How are you opening the report now?
How are you opening the report now?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
I put this text in to print the labels.
' -----------------------------------------------------------Print the complete list of labels.
'If PrintAuto = True And flag = 1 Then
' DoCmd.OpenReport "WO_Label", acViewNormal
'End If
And, its just printing the first label only at the moment.
' -----------------------------------------------------------Print the complete list of labels.
'If PrintAuto = True And flag = 1 Then
' DoCmd.OpenReport "WO_Label", acViewNormal
'End If
And, its just printing the first label only at the moment.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
I put this text in to print the labels.
' -----------------------------------------------------------Print the complete list of labels.
'If PrintAuto = True And flag = 1 Then
' DoCmd.OpenReport "WO_Label", acViewNormal
'End If
And, its just printing the first label only at the moment.
' -----------------------------------------------------------Print the complete list of labels.
'If PrintAuto = True And flag = 1 Then
' DoCmd.OpenReport "WO_Label", acViewNormal
'End If
And, its just printing the first label only at the moment.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Label run.
What happens if you change acViewNormal to acViewPreview? How many records do you see?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
Just the 1 still hans
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
Although the query does show 3
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Label run.
1) Have you set the query as Record Source of the report?
2) Does the report have something set in the Filter property, and Yes in the Filter on Load property? If so, clear the Filter Property and set Filter on Load to No.
3) Does the report have an On Load or On Open event procedure?
2) Does the report have something set in the Filter property, and Yes in the Filter on Load property? If so, clear the Filter Property and set Filter on Load to No.
3) Does the report have an On Load or On Open event procedure?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
1) Have you set the query as Record Source of the report?
Yes
2) Does the report have something set in the Filter property, and Yes in the Filter on Load property? If so, clear the Filter Property and set Filter on Load to No.
Filter (blank)
Filter on Load No
3) Does the report have an On Load or On Open event procedure?
on open only
as below.. commented out atm
Private Sub Report_Open(Cancel As Integer)
'Me.Printer.LeftMargin = 0
'Me.Printer.RightMargin = 0
'Me.Printer.BottomMargin = 0
'Me.Printer.TopMargin = 0
End Sub
Yes
2) Does the report have something set in the Filter property, and Yes in the Filter on Load property? If so, clear the Filter Property and set Filter on Load to No.
Filter (blank)
Filter on Load No
3) Does the report have an On Load or On Open event procedure?
on open only
as below.. commented out atm
Private Sub Report_Open(Cancel As Integer)
'Me.Printer.LeftMargin = 0
'Me.Printer.RightMargin = 0
'Me.Printer.BottomMargin = 0
'Me.Printer.TopMargin = 0
End Sub
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Label run.
We're not getting any closer to a solution. Could you create a stripped down copy of the database, zip it and attach the zip file to a reply?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
Yea, will do tomorrow hans. thanks.
at the moment, i have two other problems..
Suddenly its changed the label size from 38mm (wide label), to 38 x 90mm.. and it keeps changing it back for some strange reason.. so it started printing a huge label.
its throwing an error on
objTextStream.Close
that it never did before..
at the moment, i have two other problems..
Suddenly its changed the label size from 38mm (wide label), to 38 x 90mm.. and it keeps changing it back for some strange reason.. so it started printing a huge label.
its throwing an error on
objTextStream.Close
that it never did before..
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
Zipped copy
You do not have the required permissions to view the files attached to this post.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Label run.
I understand that you don't want to share sensitive information, but without any records at all in the OptionData table it's impossible to test anything.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Label run.
If the text file is not found, objTextStream will not be initialized, so it can't be closed either. You could use
or
Code: Select all
If Not objTextStream Is Nothing Then
objTextStream.Close
End If
Code: Select all
On Error Resume Next
objTextStream.Close
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Label run.
I notice that all controls in the report(s) are in the page header. They should be in the Detail section.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 419
- Joined: 04 Feb 2010, 11:46
Re: Label run.
This is the text file.
You do not have the required permissions to view the files attached to this post.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!