UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V  1 2 >  (Go to first unread post)
   Reply to this topicStart new topic
> The Number Of Pages That Will Be Printed, Access 2010    
 
   
mesersmith
post Mar 18 2017, 01:01 PM
Post#1



Posts: 515
Joined: 5-May 11
From: romania, calarasi


Hi there!

I will buy a label printer and when I'll use it, I'll have to set up how many identical labels I'll print.

Is there a way to set in VBA the number of pages that will be printed?
I need to know if I can have in a form a button or something like this and with it to set the number of page that will be printed.

--------------------
Marius-Romania
Go to the top of the page
 
theDBguy
post Mar 18 2017, 01:46 PM
Post#2


Access Wiki and Forums Moderator
Posts: 69,412
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Have a look at this demo in the Code Archive.

Cheers!

--------------------
Go to the top of the page
 
mesersmith
post Mar 18 2017, 03:24 PM
Post#3



Posts: 515
Joined: 5-May 11
From: romania, calarasi


I looked at this demo, but I did not understand if it can do what I need.
It's to hard for me all that codes.
I'll try to find something more easy.


--------------------
Marius-Romania
Go to the top of the page
 
mesersmith
post Mar 18 2017, 03:35 PM
Post#4



Posts: 515
Joined: 5-May 11
From: romania, calarasi


More than that, I look over all the code and I can't see where the code gives commands directly to printer, to print more than a page.
After all, this is what I need, to tell the printer to print more than a page. Does'n matter if the printer is for labeling or is normal printer.
So, it is possible to tell the printer to print 2, 3 or 4 pages?

Is there a way to suppress the printer window like in image below?
Is there a way to auto complete the number of copies? Or is another way to do this?


Attached File  ScreenShot002.jpg ( 113.11K )Number of downloads: 0

This post has been edited by mesersmith: Mar 18 2017, 03:59 PM

--------------------
Marius-Romania
Go to the top of the page
 
theDBguy
post Mar 18 2017, 04:41 PM
Post#5


Access Wiki and Forums Moderator
Posts: 69,412
Joined: 19-June 07
From: SunnySandyEggo


Hi Marius,

Did you download the same file I was talking about. Here's an image of the form from the demo.

Attached File  copies.png ( 28.04K )Number of downloads: 3


The arrow points to where you would enter how many copies you want to be printed. Isn't it what you're asking for?

Also, the demo file includes a Word document explaining how to use the demo. Rather than looking at the code to understand how it works, have you looked at the Word document?

--------------------
Go to the top of the page
 
mesersmith
post Mar 18 2017, 05:24 PM
Post#6



Posts: 515
Joined: 5-May 11
From: romania, calarasi


Thanks, DB for your answers.

Now I understand how your exemple works.
He put in the same report the number of labels that is in textbox "no copies".
Wich is very nice idea. I did not think like that.

I was thinking to suppress the window that shows the printer and the number of copies and to access directly the printer and print 2 or 3 pages.
And I need to work in this way because I'll have a label printer wich use 30mm wide ribon and 30m long.
After each printed label, the printer cuts the label automaticaly.

If I use the ideea on your demo, the printer will print on my ribon 2 or 3 label, but I'll have only one cut, in the end of printing and this is not good.

So, I need to make a report with only one label on it an print that report 2, 3 or 4 times, according to my needs.

I can do this in classic way, to push print button from my report, open that window, select in it the number of my copies and press print and voila, I have 2,3 or 4 copies. But I thinking that is a way to do this automaticaly.

--------------------
Marius-Romania
Go to the top of the page
 
theDBguy
post Mar 18 2017, 05:26 PM
Post#7


Access Wiki and Forums Moderator
Posts: 69,412
Joined: 19-June 07
From: SunnySandyEggo


Hi Marius,

Just to be clear, it's not my demo, it's Bernie's (pere_de_chipstick). Second, have you tried it? I suspect it should do what you're wanting to do, but the only way to be sure is to try it. Let me know if it doesn't do what you want.

--------------------
Go to the top of the page
 
mesersmith
post Mar 18 2017, 05:30 PM
Post#8



Posts: 515
Joined: 5-May 11
From: romania, calarasi


Yes, I just tried.
It do just like I described before.
If you put 10 copies, there will be 10 copies of the same label, but in the same report, wich is not good for me.
I just need to print the same page, 10 times, not the same word write 10 times in the same page.

--------------------
Marius-Romania
Go to the top of the page
 
theDBguy
post Mar 18 2017, 06:16 PM
Post#9


Access Wiki and Forums Moderator
Posts: 69,412
Joined: 19-June 07
From: SunnySandyEggo


Okay, thanks for confirming how the demo works. I'll see if I can contact Bernie to give us his opinion. I imagine there must be something he or you can do to change the behavior a little bit by modifying the code. Cheers!

--------------------
Go to the top of the page
 
mesersmith
post Mar 18 2017, 06:21 PM
Post#10



Posts: 515
Joined: 5-May 11
From: romania, calarasi


I search on UA and find this and this is exactly what I need:
http://www.UtterAccess.com/forum/index.php...33&hl=print

I tried my self, but now I'm home and don't have any printer, so I use Microsoft print to PDF in stead of any printer.
But even if I set 10 pages to print, it save only 2.
Could be because of this Microsoft print to pdf?


--------------------
Marius-Romania
Go to the top of the page
 
theDBguy
post Mar 18 2017, 06:26 PM
Post#11


Access Wiki and Forums Moderator
Posts: 69,412
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Glad to hear you're making progress. I've sent a message for Bernie and others to take a look. We'll have to wait and see what they say.

--------------------
Go to the top of the page
 
doctor9
post Mar 20 2017, 08:59 AM
Post#12


UtterAccess Editor
Posts: 16,996
Joined: 29-March 05
From: Wisconsin


mesersmith,

Pardon me for jumping in...

Just to clarify what you're trying to do: It sounds like you have a label that prints only once on a page. If you want to print ten labels, that means you want to print ten pages with one label on each page. Is this correct?

If so, why not just use a report that is set up to print only label per page? To get multiple copies/pages, you can do this:

First, create a new table:

CODE
tblMultiples

MultipleNumber [Primary Key, Integer, No Duplicates]

In the MultipleNumber, add records with increasing values, up to a number that will be the maximum number of labels you can print. So, if you will never print more than 15 records at a time, the table would have 15 records with values of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, and 15.

Next, In the RecordSource for your report, add the tblMultiples table on the Design Grid, but do not join it to any of the other tables in the RecordSource. Since it stands alone, the report's query will default to having 15 duplicate records where before it would only have one record (the one supplying data to the label) because there are 15 records in the tblMultiples table.

To limit the report to a varying number of records, you would add a WHERE clause dynamically with VBA or a macro. I'm assuming you have a command button to print the report, and a control where the user can select the number of labels to print. In the command button's Click event, you'd have something like this:

CODE
DoCmd.OpenReport "rptLabelReport", acPreview, , "[MultipleNumber]<=" & Me.intSelectedNumberOfLabels


Now, if the control named intSelectedNumberOfLabels on the form with the command button contains a 5, then 5 labels will print.

Hope this helps,

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
pere_de_chipstic...
post Mar 20 2017, 11:06 AM
Post#13


UtterAccess Editor
Posts: 10,056
Joined: 8-November 07
From: South coast, England


Hi mesersmith

A label printer can really be viewed as a printer that prints a single label per page with a custom page size, each page printing a single record.

The way Access prints is to move the record pointer in the recordset one record forward as it prints them. The demo prevents the record pointer moving until the record has been printed out the required number of times.

the relevant code is :
CODE
If CopyCount& < intCopies Then
Me.NextRecord = False
Me.PrintSection = True
CopyCount& = CopyCount& + 1
End If


The important point to note is that the label is viewed as a full page on a label printer, while the demo is primarily designed to demonstrate label printing on A4 sheets with multiple labels (e.g. Avery L7651 labels), however the same principle applies of not moving the record pointer forward until all the required copies are printed.

hth

--------------------
Warm regards
Bernie
Go to the top of the page
 
pere_de_chipstic...
post Mar 20 2017, 11:58 AM
Post#14


UtterAccess Editor
Posts: 10,056
Joined: 8-November 07
From: South coast, England


PS.

A simpler way of printing multiple copies of a report is probably using the VBA printout command:

CODE
DoCmd.OpenReport "YourReportName", acViewPreview
DoCmd.SelectObject acReport, "YourReportName"
DoCmd.PrintOut acPrintAll, , , acHigh, intCopies
DoCmd.Close acReport, "YourReportName"


where intCopies is the number of copies you require.

hth

--------------------
Warm regards
Bernie
Go to the top of the page
 
doctor9
post Mar 20 2017, 12:35 PM
Post#15


UtterAccess Editor
Posts: 16,996
Joined: 29-March 05
From: Wisconsin


Bernie,

Ah, I had forgotten about the "copies" argument for printing - much simpler than my suggestion! thumbup.gif

I use the "table of multiples" strategy for when I print multiple labels on a single sheet, and just figured if the label report was set up for 1 label per page, it would be an easy transition.

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
pere_de_chipstic...
post Mar 21 2017, 04:00 AM
Post#16


UtterAccess Editor
Posts: 10,056
Joined: 8-November 07
From: South coast, England


Hi Dennis

The copies argument in the Printout command does seem to be overlooked, possibly because of the need to precede it with the select object?

But I don't use the table of multiples either, as multiple copies can be easily encoded in the report VBA module:

CODE
Option Compare Database
Option Explicit

Dim BlankCount&
Dim CopyCount&
Dim intCopies As Integer
Dim intBlanks As Integer

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    If BlankCount& < intBlanks Then
        Debug.Print BlankCount& & "  " & intBlanks
        Me.NextRecord = False
        Me.PrintSection = False
        BlankCount& = BlankCount& + 1
    ElseIf CopyCount < intCopies Then
        Me.NextRecord = False
        Me.PrintSection = True
        CopyCount& = CopyCount& + 1
    Else
        CopyCount& = 0
    End If
    
End Sub

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
    Dim strArgs() As String
    
    BlankCount& = 0
    CopyCount& = 0
    
    strArgs() = Split(Me.OpenArgs, "|")
    intBlanks = strArgs(0)
    intCopies = strArgs(1) - 1
    
End Sub

Then the OpenReport command OpenArgs argument is used to pass the number of blank labels (if needed) and copies.

CODE
DoCmd.OpenReport "ReportName", acViewPreview, , strCrit, , intBlanks & "|" & intCopies


This gives the same number of copies for each separate record, if different numbers of copies (labels) are needed dependent on the record, then a 'Copies' field can be added to the underlying recordsource for the report, and the copy count for the record is read when the record pointer is moved forward.

Cheers
This post has been edited by pere_de_chipstick: Mar 21 2017, 04:34 AM

--------------------
Warm regards
Bernie
Go to the top of the page
 
mesersmith
post Mar 21 2017, 02:41 PM
Post#17



Posts: 515
Joined: 5-May 11
From: romania, calarasi


Thanks for all your answer.

My ideea is to print one label on one page and print that page more than once.
I have to do this because I have to use the automatic cutter wich the printer have.
So, the printer will cut automaticaly the label after the report was printed.
If I need 2 labels, I will print the same report twoice.

For the moment, I didn't buy the printer yet, but I did some test with a normal printer and when I print the report, first it opens an windows wich belong to printer driver.

Attached File  ScreenShot006.jpg ( 156.7K )Number of downloads: 2




If the label printer have the same windows, with your ways, with your codes, can I eliminate that window?
Because I want to select the number of my copies in my report, not in this window.
This post has been edited by mesersmith: Mar 21 2017, 02:43 PM

--------------------
Marius-Romania
Go to the top of the page
 
doctor9
post Mar 21 2017, 02:45 PM
Post#18


UtterAccess Editor
Posts: 16,996
Joined: 29-March 05
From: Wisconsin


mesersmith,

> I want to select the number of my copies in my report, not in this window.

How are the users opening the report? If they're opening it directly from the Navigation Pane on the side of the screen, I'd recommend changing this. My basic rule for user interfaces is that users only interact with data through forms. They never see the tables/queries/reports/etc. on the side. If they want to print 4 copies of a report, you can have a textbox (or a combobox) on a form where they can select the number of copies, and a command button that prints the report (or opens the report in Preview mode).

I try very hard to stay away from having controls on reports. Reports, in my mind, are meant for paper or PDF.

Hope this helps,

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
mesersmith
post Mar 21 2017, 02:48 PM
Post#19



Posts: 515
Joined: 5-May 11
From: romania, calarasi


Hi, Doc!

I never let the user to see the table and the queries.
Always they have forms and reports only.
More than this, on my work I don't have licenced Access so I use Runtime Access.
In runtime there are no table or query visible.

--------------------
Marius-Romania
Go to the top of the page
 
doctor9
post Mar 21 2017, 02:56 PM
Post#20


UtterAccess Editor
Posts: 16,996
Joined: 29-March 05
From: Wisconsin


mesersmith,

In your screenshot, it appears that there are buttons on the report. But how do the users open the report in the first place? You didn't answer that question. The answer will lead you to where/how your users should choose the number of copies.

Hope this helps,

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
2 Pages V  1 2 >


Custom Search
RSSSearch   Top   Lo-Fi    30th April 2017 - 12:15 AM