Results 1 to 6 of 6

Thread: Printing from application to network printer...Nobody knows???

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2004
    Posts
    79

    Printing from application to network printer...Nobody knows???

    Hope I'm on the correct forum for my question. I am naming a particular printer for a form to print to in my vb app. The printer is called "Form Printer on Server1" where Server1 is the server name the printer was installed on. On each workstation I installed that printer and the program works fine on all except two workstations. I have found that when I install the printer on those 2 workstations, the Windows 'Printer Install' software does not accept the way I type in "Server1" and it changed it to something like "sErVer1" on one workstation and to "SERver1" on the other one. So when I run the app, the printer named in the app as being on "Server1" is not found and the data prints to that workstation's default printer.

    Does anybody know where Windows picks up the server name when you install a printer? I went into the hosts file and entered the IP address of the server and the correct 'case' name (as Server1) but that did not help. Any ideas?
    Last edited by rbrook; May 18th, 2005 at 08:20 AM. Reason: need help

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Printing from application to network printer

    Well, this is certainly a new one.

    Are all workstations running the same desktop OS?
    Same patches?
    Same everything?

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Printing from application to network printer

    I just use the IP address of the remote printer. Are you using the CDC and ShowPrinter ? It has been found to be very unreliable.

    Here is better code to use: http://support.microsoft.com/kb/322710/EN-US/#7

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2004
    Posts
    79

    Re: Printing from application to network printer

    Yes, all of the user's workstations have Wk2 installed. Here is the code in the app where I assign the printer.


    Dim X As Printer
    For Each X In Printers
    If X.DeviceName = "\\Server1\Form Printer" Then
    Set Printer = X
    Exit For
    End If
    Next

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Printing from application to network printer

    I use this, which highlights the default printer, but allows my program to change it. I have an app that reads the chosen printername from a file, and automatically sets that when the app starts.
    For some reason I get the IP address instead of the server name. It might have something to do with AV software running on my machine.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Combo1_Click()
    4.   Dim p As String
    5.   Dim prt As Printer
    6.   p = Combo1.List(Combo1.ListIndex)
    7.   For Each prt In Printers
    8.     If prt.DeviceName = p Then
    9.     Set Printer = prt
    10.     End If
    11.   Next prt
    12. End Sub
    13.  
    14. Private Sub Form_Load()
    15.   Dim x%
    16.   Dim prt As Printer
    17.   Combo1.Clear
    18.   For Each prt In Printers
    19.     Combo1.AddItem prt.DeviceName
    20.   Next prt
    21.   For x = 0 To Combo1.ListCount
    22.       If Combo1.List(x) = Printer.DeviceName Then
    23.       Combo1.TopIndex = x
    24.       Combo1.ListIndex = x
    25.       Exit Sub
    26.     End If
    27.   Next x
    28. End Sub

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2004
    Posts
    79

    Unhappy Re: Printing from application to network printer

    I cannot find a solution to this problem. My application does find the printer when I use the code I pasted in here earlier, but it's the name on the printer at the workstation which is incorrect. I've tried to go into the printer properties to rename it, but the " on Server1" is not part of the name at that point. Please, does anybody know where the workstation could be picking up the crazy upper/lower cased name of the server it assigns to the printer when I do the install? I can find nobody anywhere who can figure this one out.

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