Results 1 to 8 of 8

Thread: print access form to specific printer

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    print access form to specific printer

    Hi, i have been asked if i can set an access database to print to a specific printer rather than the default. i have looked it up and there seems to be a way to print an access report to specific printer. Can the same be done with a form in access?

    i have looked at the form in desigtn view and at the print button onclick event i believe it is possible to send from here to a specific printer. Can this be done?

    I have a little experience in using vbscript but i have no idea how to do this or even if its possible. any suggestions, tips or where to find an example of how to do this?

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: print access form to specific printer

    Hi,

    Welcome to the forums...

    Is the form created in the access database or using VB 6.0?

    greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: print access form to specific printer

    hi, thanks for answering, the form is in access (2003) and there is a button on the form that prints the data. I looked at it in design view and saw the code -sorry but i havent a clue how this works - but i assume someone used vb in access to create this and the functionality of the form??? i have seen examples of how to enumerate through available printers and print a report in access so can i add to the onclick event of the button on this form and select a specific printer rather than the default printer of the machine?

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: print access form to specific printer

    here is the code on the form, i'm totally unfamiliar with it, is it possible to tell it to print to a printer other than the default?

    Private Sub Command55_Click()
    On Error GoTo Err_Command55_Click

    Dim stDocName As String

    stDocName = "Job Card1"
    DoCmd.OpenReport stDocName, acNormal



    Exit_Command55_Click:
    Exit Sub

    Err_Command55_Click:
    MsgBox Err.Description
    Resume Exit_Command55_Click

    End Sub

  5. #5
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: print access form to specific printer

    I think there is a command in vb 6.0 to let the user choose the correct printer
    when a command button for print is clicked. The command can also be applied to access vba..

    Have you tried doing research on the parameters of OpenReport?

    greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: print access form to specific printer

    Hi, thanks for that suggestion, as i said i know a little vbscript but this is way beyond me but it makes sense to check out the parameters of OpenReport, i'll try that and see what i can find on that.

    I just don't understand how this line opens and prints the doc..
    Code:
    DoCmd.OpenReport stDocName, acNormal

  7. #7
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: print access form to specific printer

    hi,

    so, you are using vbscript for your asp applications..well, that's similar to vba except for some syntax for the web...

    stdocname stands for the report document name while acnormal denotes printing directly to printer...acpreview for previewing first before printing...

    greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: print access form to specific printer

    Hi, thanks for the explanation, but i couldn't find any examples of parameters that would select a printer to print to. i am unable to test the application because it is linked with sage on the network, i would have to go to the company and test it there - so trial and error isn't an option...
    would something like this work?

    Code:
    Application.Printer = Application.Printers("my specific printer")

Posting Permissions

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



Click Here to Expand Forum to Full Width