Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One printer is always default even when its not??

Status
Not open for further replies.

dedo8816

Programmer
Oct 25, 2006
94
GB
Hi, my program is written in VB6, it pulls information onto a form for the use to read and print a label from, the label is basically another form with the information displayed in a printer friendly way onto a little 4" x 4" label.
Ive set the printer.default = False, ive set it as = True, doesnt matter. What ever printer i use the first time i print, the program will use regardless of which printer is selected unless i shutdown the program out of memory and reload it.

Any hints?
 
What code are you using to set the printer?

Beir bua agus beannacht!
 
Private Sub cmdprint_Click()

CommonDialog1.DialogTitle = "Label Printer"
CommonDialog1.CancelError = True
CommonDialog1.PrinterDefault = False

On Error Resume Next

CommonDialog1.ShowPrinter

If Err Then
MsgBox "Print Cancelled"
Exit Sub
End If
Printer.ScaleMode = 6
Printer.FontSize = 8
Printer.CurrentY = Printer.CurrentY + 180

Printer.Copies = CommonDialog1.Copies

frmprnprev1.PrintForm

Dim ExceedMaxPrint
If CommonDialog1.Copies > 10 Then
ExceedMaxPrint = MsgBox("You are about to print 10 or more copies, do you want to continue?", vbYesNo)
If ExceedMaxPrint = vbYes Then
Printer.EndDoc
Else: Exit Sub
End If
End If

TxtSearch.SetFocus

Dim reply
reply = MsgBox("Would you like to clear all fields?", 36)
If reply = 6 Then
TxtSearch.Text = ""
TxtFor.Text = ""
TxtQTY.Text = ""
TxtLotR.Text = ""
txtpartno.Text = ""
txtloc.Text = ""
txtrev.Text = ""
DataEnvironment1.rsCommand1.MoveFirst
TxtSearch.SetFocus
cmdprint.Default = False
CmdSearch.Default = True
CommonDialog1.Copies = 1
CommonDialog1.PrinterDefault = False
Else: CommonDialog1.Copies = 1
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top