Printing

F

Finsalgal

Hi

I am new to access vba. Can you tell me if on a report that prompts for
information. ie: qty made, batch no and order ref. At the moment it works
fine this is to produce labels so the infor i input prints a label with that
information on. What i would like to do is for it to ask me how many copies
i want to print. Just like the print command you would normally use.

Many thanks
 
D

Daniel

One solution would be to use an InputBox function to ask the user the number
of copies required then use the use the PrintOut method of the DoCmd object.

Check Access Help on DoCmd objects.

Daniel
 
J

janet

Janet,

This is just air code but I would probably change your Print_Click code like
so

**************
Private Sub Print_Click()
On Error GoTo Err_Print_Click

Dim stDocName As String
Dim MyForm As Form
Dim intQty As Integer

intQty = InputBox("How many copies would you like printed?")

stDocName = "Input Form 2"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut , , , , intQty
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_Print_Click:
Exit Sub

Err_Print_Click:
MsgBox Err.Description
Resume Exit_Print_Click

End Sub
************

The printout input variable are

'expression.PrintOut(PrintRange, PageFrom, PageTo, PrintQuality, Copies,
CollateCopies)

therefore you should simply need to input an integer value as your 5th input
variable to specify the number of copies.

Try it out and let me know,

Daniel
































- Show quoted text -

Hi Daniel


I must be doing something wrong can't seem to get it to work.

The report I have done has input boxes first input box is qty, next is
batch no then there is a part no. So i enter 3 forms of criteria.
But I cannot seem to get your code to work nothing happens!! help

Many thanks

J
 
J

janet

Hi Daniel

I must be doing something wrong can't seem to get it to work.

The report I have done has input boxes first input box is qty, next is
batch no then there is a part no. So i enter 3 forms of criteria.
But I cannot seem to get your code to work nothing happens!! help

Many thanks

J- Hide quoted text -

- Show quoted text - Hi Daniel

Can I put a command button on a report and put code behind that to
print??????


Many thanks

J
 
R

RD

Hi Janet,

There is a nifty bit of code to be found here:
http://www.peterssoftware.com/ls.htm

It's Peter's Software Label Saver. It not only allows you to input the number
of copies but where on a page it should start (hence Label Saver). The one
thing that isn't made clear in the instructions is that you must design the
labels yourself. That is to say you design a report with the fields you need on
the label. You have to make sure it is sized just right for the labels you're
using. You set the Height in the report Detail, the Width in the report's
properties and columns and margins in Page Setup. Once you have your label
designed and this code put in all the places mentioned in the instructions it
works great.

Hope this helps,
RD
 
Top