I am trying to make a label print automatically when a membership card is scanned. The scan event needs to kick off the print of the label. I don't want to create a button that needs to be pushed to print the label. I need it to happen automatically. In our database we have an after scan code listed below. Can anyone tell me where I should place the print code and what it should be? I tried to insert this:
VB Code:
Printer.Print "This is a test" Printer.EndDoc
But, I couldn't even get it to print that. I will be inserting to attributes out of our database onto the labels that will print.
VB Code:
[COLOR=DarkOliveGreen]'This event occurs immediately after a card has been scanned but before any processing has taken place.[/COLOR] Public Sub MembershipScanning_CardScanned(oMemScanDisplay As Object, ByVal sScannedData As String, ByRef lMembershipID As Long, ByRef lMembershipTableID As Long, ByRef lMembershipCardID As Long, ByRef bCancelDefault As Boolean) 'oMemScanDisplay : Reference to the membership scanning display dataobject 'sScannedData : Indicates the data that was scanned 'lMembershipID : Allows you to return the MembershipID to be displayed 'lMembershipTableID : Allows you to return the MembershipTableID to be displayed 'lMembershipCardID : Allows you to return the MembershipCardID to be displayed 'bCancelDefault : Indicates that the system should skip the default processing of the scanned data and operate instead on the IDs returned from this event Dim oScanDisplay As IBBMemScanDisplay On Error GoTo ErrHandler Set oScanDisplay = oMemScanDisplay If Not oScanDisplay Is Nothing Then '< place your custom CardScanned code here > End If Set oScanDisplay = Nothing On Error GoTo 0 Exit Sub ErrHandler: Dim sErr As String sErr = Err.Description On Error GoTo 0 '< place your custom error handling code here > MsgBox "Error processing MembershipScanning_BeforeDisplay : " & sErr Set oScanDisplay = Nothing Exit Sub End Sub 'This event occurs after the card has been scanned and the information is displayed Public Sub MembershipScanning_AfterDisplay(oMemScanDisplay As Object) 'oMemScanDisplay : Reference to the membership scanning display dataobject Dim oScanDisplay As IBBMemScanDisplay On Error GoTo ErrHandler Set oScanDisplay = oMemScanDisplay Begin: Printer.Orientation = vbPRORLandscape Printer.Font = "Courier new" ' "r_ansi" '"TIMES NEW ROMAN" Printer.FONTBOLD = True Printer.FONTSIZE = 10 Application.VBE.VBProjects(1).Description = "Hot Sauce" Debug.Print Application.VBE.VBProjects(1).Description Printer Printer.Print "This is a test" Printer.EndDoc If Not oScanDisplay Is Nothing Then End If Set oScanDisplay = Nothing On Error GoTo 0 Exit Sub ErrHandler: Dim sErr As String sErr = Err.Description On Error GoTo 0 '< place your custom error handling code here > MsgBox "Error processing MembershipScanning_AfterDisplay : " & sErr Set oScanDisplay = Nothing Exit Sub End Sub
