Link to home
Start Free TrialLog in
Avatar of gincho
gincho

asked on

print single labels from form in Access

I wish to enter data in an Access form and save it to the database by clicking the save button. This is simple enough but I also wish to print a label with the information from the form. Is there VBA code to do this? How would I format the label ? If I use Avery labels how can I specify the position of the label I wish to print. I have come accross which I think might work for skipping to the next available label on the A4 sheet. Any thought are welcome. Thanks
ASKER CERTIFIED SOLUTION
Avatar of gordonmann
gordonmann
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of puppydogbuddy
puppydogbuddy

Here is a pictorial tutorial step by step.

        http://www.databasedev.co.uk/mailing_labels.html
Avatar of Jeffrey Coachman
gincho,

Give this a try:

If you only need 1 label at a time, then perhaps the simplest way might be to just use Microsoft Word.
(Word has a dialog box designed to allow printing of single labels)

In your form, actually build the label in a textbox, highlight it, and copy it:

Private Sub cmdBuildLabel_Click()
    'Build Your Label
    Me.txtAddress = [CompanyName] & vbCrLf & [Address] _
    & vbCrLf & [City] & ", " & [Region] & "  " & [PostalCode]
    'Highlight the text
    Me.txtAddress.SetFocus
    'Copy the text to the clipboard
    DoCmd.RunCommand acCmdCopy
   'Display a confirmation message
    MsgBox "The text: " & vbCrLf & vbCrLf & Me.txtAddress & vbCrLf & vbCrLf _
                        & "...is now stored in the Windows Clipboard, and is ready to be pasted."
End Sub

Then Open Word, and click:
Tools-->Envelopes and Labels
Select the “Labels” tab
Paste in the text
From the “Print” option group, select: Single Label

From there you can select the:
The Label type/size
The Row of the label
The Column of the label

Then just click “Print”

Hope this helps

Jeffrey Coachman

Avatar of gincho

ASKER

booag2000, this is a good idea but they need something more automated and shorter.

puppydogbuddy, thanks, I need the inputting of the info and and the printing of the single label to occur in a short number of steps as possible.  

gordonmann, i will work with this and see if I can skip to the next unpeeled label.

Thanks all
That will be difficult - why not purchase an inexpensive Dymo label printer.
gincho

I'll play around with instanciating Word, tonight.
gincho:,

OK...try this:
https://filedb.experts-exchange.com/incoming/ee-stuff/2121-WordPrint1Label.zip

The paper default papaer size is based on your default printer.
All of the label options (Brand, Style Number...ect) are in the "Single Label setup options" in the code.
You can record a macro in Word (Tools-->Letters and Mailings-->Envelopes and labeles-->Labels) with you own setting for the label brand and configuration. You can use this macro to compare the two sets of code.

Try to adapt my sample to fit your application.

Post back here if you have any questions.

Jeff Coachman
gincho,

See here as well:
http://support.microsoft.com/kb/231801

Jeff Coachman
gincho,

Oh, and by the way, there is really no need to have a button to "Save" a record.
When you create a new record in Access, the each field is "updated" as you fill them in.
(For example: If you create a new record and fill in 3 fields, then close the form, when you return to that record, the info in the three fields will still be there.)

Then when you move to a new record the entire "Record" is Updated and Inserted.

Jeff Coachman