Results 1 to 2 of 2
  1. #1
    dlab85 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    47

    Application.Printer change causes Error

    Hey Everyone,
    I inherited a database we use to track samples we receive (see attached zip). The main function is to log samples in, and the program prints out two copies of a barcode label. Our IT changed label printer from a local printer to a printserver printer (the name changed as well).
    1. I attempt to change the Application.Printers name in this portion of the coding in Form_frmEnterSample:
    Code:
    Private Sub Form_Load()    SampleID.Value = ""
        Submission.Value = ""
        DoCmd.GoToControl "Submission"
        printBatch = 0
        Set Application.Printer = Application.Printers("ZebraS4M")
    End Sub
    2. When I change the printer name in Application.Printers, I receive an error in this portion in the DoCmd... line of the coding Form_frmEnterSample:
    Code:
        End If    
        DoCmd.OpenReport "rptLabels", acViewNormal
        DoCmd.OpenReport "rptLabels", acViewNormal
         
    End Sub
    I believe part of my problem also lies in coding on Report_rptLabels:


    Code:
    Option Compare Database
    
    Dim prtDefault As Printer
    
    
    
    
    Private Sub Report_Load()
        Set Application.Printer = Application.Printers("PA3224-ZebraS4M on PrintServer")
    End Sub
    Any specific suggestions on where coding should be changed or deleted or modified would be greatly appreciated. I am moderately familiar with Access, but still pretty green with VBA. Greatly appreciated!
    Attached Files Attached Files

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    I think incorrect printer name may be causing the error, check it by looping through the printers
    Code:
          Dim prt As Printer
      For Each prt In Application.Printers
          Debug.Print prt.DeviceName
      Next prt
    Does this helps ?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 02-25-2014, 11:46 AM
  2. Replies: 4
    Last Post: 01-05-2014, 02:09 PM
  3. Replies: 15
    Last Post: 09-06-2012, 06:25 PM
  4. Trying to Change Default printer
    By sims.anderson2010 in forum Programming
    Replies: 2
    Last Post: 03-08-2012, 08:07 AM
  5. Access application to Web based application
    By admaldo in forum Access
    Replies: 0
    Last Post: 06-12-2008, 06:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums