D
Dannyboy
I get "object required" error, but I don't know why.
I have written a very simple access cash register program.
I am trying to open a cash drawer attached to my epson receipt printer.
I have registered mscomm32.ocx in Access2k and referenced it in vb.
The code will be inserted in the code below, where the explanation appears.
Sub PrintReceiptOpenDrawer()
Dim stDocName As String
stDocName = "rptReceipt"
'****** -- START -- This line is calls the Sub that fixes wonky page
argins -- *************
Call SetMargins(stDocName)
'****** -- END -- Fix for page margins -- *************
'This section prints the receipt (Access report).
DoCmd.OpenReport stDocName, acPreview
' DoCmd.RunCommand acCmdZoom50
DoCmd.PrintOut , , , , 1
Reports!rptReceipt.Visible = False
DoCmd.Close acReport, stDocName, acSaveNo
' Here is where
' the code should go
' to open the cash drawer.
End Sub
I got a bunch of code snippets off the internet, but they all generate "object
required" error. I am not familiar with mscomm so I don't know what to change.
below are some of the code snippets in their entirety.
************************************************************
Private Sub OpenDrawer_Click()
' Send the open drawer command
MSComm1.Output = Chr(27) + Chr(112) + Chr(0) + Chr(25) + Chr(250)
End Sub
************************************************************
MSComm1.Output = Chr$(&H1B) + Chr$(&H70) + Chr$(0) + Chr$(25) + Chr$(250)
************************************************************
Open "COM1" For Output Access Write As #1
Print #1, Chr(27) & Chr(112) & Chr(0)
Close #1
************************************************************
MSC.CommPort = "COM1:"
MSC.Settings = "9600,N,8,1"
MSC.PortOpen = True
MSC.Output = Chr$(7)
MSC.PortOpen = False
************************************************************
with MSComm1
.CommPort = 1
.Settings = "300,n,8,1"
.PortOpen = True
.Output = Chr$(7)
.PortOpen = False
end with
************************************************************
I have written a very simple access cash register program.
I am trying to open a cash drawer attached to my epson receipt printer.
I have registered mscomm32.ocx in Access2k and referenced it in vb.
The code will be inserted in the code below, where the explanation appears.
Sub PrintReceiptOpenDrawer()
Dim stDocName As String
stDocName = "rptReceipt"
'****** -- START -- This line is calls the Sub that fixes wonky page
argins -- *************
Call SetMargins(stDocName)
'****** -- END -- Fix for page margins -- *************
'This section prints the receipt (Access report).
DoCmd.OpenReport stDocName, acPreview
' DoCmd.RunCommand acCmdZoom50
DoCmd.PrintOut , , , , 1
Reports!rptReceipt.Visible = False
DoCmd.Close acReport, stDocName, acSaveNo
' Here is where
' the code should go
' to open the cash drawer.
End Sub
I got a bunch of code snippets off the internet, but they all generate "object
required" error. I am not familiar with mscomm so I don't know what to change.
below are some of the code snippets in their entirety.
************************************************************
Private Sub OpenDrawer_Click()
' Send the open drawer command
MSComm1.Output = Chr(27) + Chr(112) + Chr(0) + Chr(25) + Chr(250)
End Sub
************************************************************
MSComm1.Output = Chr$(&H1B) + Chr$(&H70) + Chr$(0) + Chr$(25) + Chr$(250)
************************************************************
Open "COM1" For Output Access Write As #1
Print #1, Chr(27) & Chr(112) & Chr(0)
Close #1
************************************************************
MSC.CommPort = "COM1:"
MSC.Settings = "9600,N,8,1"
MSC.PortOpen = True
MSC.Output = Chr$(7)
MSC.PortOpen = False
************************************************************
with MSComm1
.CommPort = 1
.Settings = "300,n,8,1"
.PortOpen = True
.Output = Chr$(7)
.PortOpen = False
end with
************************************************************