Results 1 to 3 of 3

Thread: Printing help please...

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    8

    Unhappy 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:

    VB Code:
    1. Printer.Print "This is a test"
    2. 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:
    1. [COLOR=DarkOliveGreen]'This event occurs immediately after a card has been scanned but before any processing has taken place.[/COLOR]
    2.  
    3. 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)
    4.     'oMemScanDisplay      : Reference to the membership scanning display dataobject
    5.     'sScannedData         : Indicates the data that was scanned
    6.     'lMembershipID        : Allows you to return the MembershipID to be displayed
    7.     'lMembershipTableID   : Allows you to return the MembershipTableID to be displayed
    8.     'lMembershipCardID    : Allows you to return the MembershipCardID to be displayed
    9.     'bCancelDefault       : Indicates that the system should skip the default processing of the scanned data and operate instead on the IDs returned from this event
    10.  
    11.     Dim oScanDisplay As IBBMemScanDisplay
    12.    
    13.     On Error GoTo ErrHandler
    14.    
    15.     Set oScanDisplay = oMemScanDisplay
    16.    
    17.     If Not oScanDisplay Is Nothing Then
    18.         '< place your custom CardScanned code here >
    19.     End If
    20.    
    21.     Set oScanDisplay = Nothing
    22.    
    23.     On Error GoTo 0
    24.    
    25.     Exit Sub
    26.    
    27. ErrHandler:
    28.     Dim sErr As String
    29.     sErr = Err.Description
    30.     On Error GoTo 0
    31.     '< place your custom error handling code here >
    32.     MsgBox "Error processing MembershipScanning_BeforeDisplay : " & sErr
    33.    
    34.     Set oScanDisplay = Nothing
    35.    
    36.     Exit Sub
    37.  
    38. End Sub
    39.  
    40. 'This event occurs after the card has been scanned and the information is displayed
    41. Public Sub MembershipScanning_AfterDisplay(oMemScanDisplay As Object)
    42.     'oMemScanDisplay      : Reference to the membership scanning display dataobject
    43.  
    44.     Dim oScanDisplay As IBBMemScanDisplay
    45.    
    46.     On Error GoTo ErrHandler
    47.    
    48.     Set oScanDisplay = oMemScanDisplay
    49.    
    50. Begin:
    51.  
    52.     Printer.Orientation = vbPRORLandscape
    53.     Printer.Font = "Courier new" ' "r_ansi" '"TIMES NEW ROMAN"
    54.     Printer.FONTBOLD = True
    55.     Printer.FONTSIZE = 10
    56.     Application.VBE.VBProjects(1).Description = "Hot Sauce"
    57. Debug.Print Application.VBE.VBProjects(1).Description
    58. Printer
    59.     Printer.Print "This is a test"
    60.     Printer.EndDoc
    61.    
    62.    
    63.     If Not oScanDisplay Is Nothing Then
    64.    
    65.     End If
    66.    
    67.     Set oScanDisplay = Nothing
    68.    
    69.     On Error GoTo 0
    70.    
    71.     Exit Sub
    72.    
    73. ErrHandler:
    74.     Dim sErr As String
    75.     sErr = Err.Description
    76.     On Error GoTo 0
    77.     '< place your custom error handling code here >
    78.     MsgBox "Error processing MembershipScanning_AfterDisplay : " & sErr
    79.    
    80.     Set oScanDisplay = Nothing
    81.    
    82.     Exit Sub
    83.  
    84. End Sub
    Last edited by si_the_geek; May 12th, 2005 at 07:27 AM. Reason: added VBCode formatting

  2. #2
    Fanatic Member Blade's Avatar
    Join Date
    Jan 1999
    Location
    Stoke-on-Trent, UK
    Posts
    527

    Re: Printing help please...

    You'd be better off re-posting this in the Visual Basic forum rather than the database forum as you're more likely to get an answer there.

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Printing help please...

    (moved thread to VBA forum)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width