|
-
May 11th, 2005, 10:29 AM
#1
Thread Starter
New Member
Printing help please...
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:
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.
'This event occurs immediately after a card has been scanned but before any processing has taken place.
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
-
May 11th, 2005, 02:15 PM
#2
Addicted Member
Re: Printing help please...
adding tags to make it easier to read
VB Code:
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
if you fail to plan, you plan to fail
-
May 11th, 2005, 06:15 PM
#3
Thread Starter
New Member
Re: Printing help please...
-
May 11th, 2005, 10:22 PM
#4
Re: Printing help please...
Your doing this in VB6 or in an Office app?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|