Results 1 to 9 of 9

Thread: Label Printing

  1. #1
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    47

    Unanswered: Label Printing

    I want to produce a list of mailing labels based upon an order date, so I have created a small dialogue box to select date, however, when i try to print the labels I'm getting the following error............. any help/ideas? btw the preview button works perfectly !!
    Attached Thumbnails Attached Thumbnails printerr.gif  

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    What's the code under those buttons ?
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  3. #3
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    47
    Originally posted by PracticalProgram
    What's the code under those buttons ?
    Preview:

    Private Sub Preview_Click()
    If IsNull([BeginDate]) Or IsNull([EndDate]) Then
    MsgBox "You must enter both beginning and ending dates."
    DoCmd.GoToControl "BeginDate"
    Else
    If [BeginDate] > [EndDate] Then
    MsgBox "Ending date must be greater than Beginning date."
    DoCmd.GoToControl "BeginDate"
    Else
    Me.Visible = False
    End If
    End If
    End Sub


    Print:

    Private Sub Print_Click()
    On Error GoTo Err_Print_Click

    Dim stDocName As String

    stDocName = "Customer Orders Labels"
    DoCmd.OpenReport stDocName, PrintMode

    Exit_Print_Click:
    Exit Sub

    Err_Print_Click:
    MsgBox Err.Description
    Resume Exit_Print_Click

    End Sub



  4. #4
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Well . . .

    . . . you said that the preview button works, and now that we see the code, I see why it "works"--it doesn't do anything ! All it does is data verification. It doesn't do a print preview. So, as far as I am concerned, it DOESN't work either.

    and what is "PrintMode" ? Is this some variable you've set somewhere else ?
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  5. #5
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    47
    Originally posted by PracticalProgram
    Well . . .

    . . . you said that the preview button works, and now that we see the code, I see why it "works"--it doesn't do anything ! All it does is data verification. It doesn't do a print preview. So, as far as I am concerned, it DOESN't work either.

    and what is "PrintMode" ? Is this some variable you've set somewhere else ?
    Hmmmm

    Well the preview form is lifted directly from the Inventory module supplied with MS Access, and guess what the preview button works there too!!

    Regarding the print button, I've tried all these:

    DoCmd.OpenReport stDocName, acNormal
    DoCmd.OpenReport stDocName, PrintMode
    'DoCmd.Close acForm, "Report Name"

    PrintMode again was in the MS examples......


  6. #6
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Are you talking about the Northwinds database ?

    What form did you pull this off of ?

    When you hit the Preview button, does the report display in a preview window ?

    There is nothing in the code you have showed us that is unusual. So you've got to break this problem down by isolating it. Have you tried putting a stop statement immediately before the DoCmd.OpenReport statement. If it gets to that point without erroring, then the the problem you are having is not on this form, or in the code, but in something associated with the report.
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  7. #7
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    To make it print you need to leave all of that other mumbo jumbo off of the end.

    Code:
    DoCmd.OpenReport stDocName
    I am assuming stDocName is a variable? If it isnt I would put that Report name in "".

    Hope this helps,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  8. #8
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    Also you may wanna consider even if it is a variable to not have it as a variable and just do the following.

    Code:
    DoCmd.OpenReport "yourreporthere"
    JS

    Originally posted by JSThePatriot
    To make it print you need to leave all of that other mumbo jumbo off of the end.

    Code:
    DoCmd.OpenReport stDocName
    I am assuming stDocName is a variable? If it isnt I would put that Report name in "".

    Hope this helps,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  9. #9
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: Label Printing

    Originally posted by Anduril
    I want to produce a list of mailing labels based upon an order date, so I have created a small dialogue box to select date, however, when i try to print the labels I'm getting the following error............. any help/ideas? btw the preview button works perfectly !!
    Make this change.

    Preview:

    Private Sub Preview_Click()
    If IsNull([BeginDate]) Or IsNull([EndDate]) Then
    MsgBox "You must enter both beginning and ending dates."
    DoCmd.GoToControl "BeginDate"
    Else
    If [BeginDate] > [EndDate] Then
    MsgBox "Ending date must be greater than Beginning date."
    DoCmd.GoToControl "BeginDate"
    Else
    Me.Visible = False
    End If
    End If
    End Sub


    Print:

    Private Sub Print_Click()
    On Error GoTo Err_Print_Click

    Dim stDocName As String

    stDocName = "Customer Orders Labels"
    DoCmd.OpenReport stDocName, acPreviewl <------------------ X




    Exit_Print_Click:
    Exit Sub

    Err_Print_Click:
    MsgBox Err.Description
    Resume Exit_Print_Click

    End
    Saludos
    Norberto

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •