D
DS
I Have this code on One form, when you click on next it opens a second
form, setting the name of the printer as well, it worked once and now I
can't get it to work again. Any help Appreciated.
Thanks
DS
Form 1
Private Sub ButnNext_Click()
Dim rtn As Long
Dim Driver As String
Dim I As Integer
Dim X As Printer
'get the current driver name
m_PrtN = CmbPrn
If Len(m_PrtN) = 0 Then
'if no driver selected exit
Exit Sub
End If
rtn = GetPrnDriverName(m_PrtN, Driver)
If rtn <> 0 Then
Driver = ""
End If
m_DrvN = Driver
'open the printer
m_hApi = BiOpenMonPrinter(TYPE_PRINTER, m_PrtN)
'if error then show error and exit sub
If m_hApi < 0 Then
ErrMsg (m_hApi)
Exit Sub
End If
DoCmd.OpenForm "MainDlg"
DoCmd.Close acForm, "StartDlg"
End Sub
Form 2
Private Sub Form_Load()
Dim title
title = m_PrtN
TitleLabel = title
ButnCanSts.Enabled = 0
m_Status = 0
m_InkStatus = 0
m_reforOfflineSt = 1
'Get OS Version
iIsNT = 0
Call IsNT
'initialize font table
Call InitializeFontTable
'check printer driver
'disable ASB bits
'Setting for TM-T88II(R)/TM-T88II(R)-051
ElseIf (m_DrvN = DRV_NAME_TM88IIR_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR_REDUCE) Or _
(m_DrvN = DRV_NAME_TM88IIR051_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR051_REDUCE) Then
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U220
ElseIf (m_DrvN = DRV_NAME_TMU220_RECEIPT) Then
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for other printers
Else
Chk00000004.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
End If
'enable/disable button
'Setting for TM-T88II(R)/TM-T88II(R)-051
If (m_DrvN = DRV_NAME_TM88IIR_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR_REDUCE) Or _
(m_DrvN = DRV_NAME_TM88IIR051_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR051_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnDrawerCtrl.Enabled = False
'Setting for TM-U220
ElseIf (m_DrvN = DRV_NAME_TMU220_RECEIPT) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for other printers (default)
Else
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
End If
End Sub
form, setting the name of the printer as well, it worked once and now I
can't get it to work again. Any help Appreciated.
Thanks
DS
Form 1
Private Sub ButnNext_Click()
Dim rtn As Long
Dim Driver As String
Dim I As Integer
Dim X As Printer
'get the current driver name
m_PrtN = CmbPrn
If Len(m_PrtN) = 0 Then
'if no driver selected exit
Exit Sub
End If
rtn = GetPrnDriverName(m_PrtN, Driver)
If rtn <> 0 Then
Driver = ""
End If
m_DrvN = Driver
'open the printer
m_hApi = BiOpenMonPrinter(TYPE_PRINTER, m_PrtN)
'if error then show error and exit sub
If m_hApi < 0 Then
ErrMsg (m_hApi)
Exit Sub
End If
DoCmd.OpenForm "MainDlg"
DoCmd.Close acForm, "StartDlg"
End Sub
Form 2
Private Sub Form_Load()
Dim title
title = m_PrtN
TitleLabel = title
ButnCanSts.Enabled = 0
m_Status = 0
m_InkStatus = 0
m_reforOfflineSt = 1
'Get OS Version
iIsNT = 0
Call IsNT
'initialize font table
Call InitializeFontTable
'check printer driver
'disable ASB bits
'Setting for TM-T88II(R)/TM-T88II(R)-051
ElseIf (m_DrvN = DRV_NAME_TM88IIR_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR_REDUCE) Or _
(m_DrvN = DRV_NAME_TM88IIR051_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR051_REDUCE) Then
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U220
ElseIf (m_DrvN = DRV_NAME_TMU220_RECEIPT) Then
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for other printers
Else
Chk00000004.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
End If
'enable/disable button
'Setting for TM-T88II(R)/TM-T88II(R)-051
If (m_DrvN = DRV_NAME_TM88IIR_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR_REDUCE) Or _
(m_DrvN = DRV_NAME_TM88IIR051_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR051_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnDrawerCtrl.Enabled = False
'Setting for TM-U220
ElseIf (m_DrvN = DRV_NAME_TMU220_RECEIPT) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for other printers (default)
Else
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
End If
End Sub