Results 1 to 4 of 4
  1. #1
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49

    Getting an error and don't know why

    Here is the code that I am running

    Private Sub txtIncomingBarcode_AfterUpdate()
    On Error GoTo txtIncomingBarcode_AfterUpdate_Error
    Me.txtDesiredCode = Mid([txtIncomingBarcode], 2, 6)


    Me.test = B32toBin([txtDesiredCode], 10)
    Debug.Print Me.test & " at " & Now()
    DoCmd.OpenForm "Consolidated Signin Form", , , "SSN ='" & Me.test & "'"
    On Error GoTo 0
    Exit Sub
    txtIncomingBarcode_AfterUpdate_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure txtIncomingBarcode_AfterUpdate of VBA Document Form_Form13"
    End Sub
    Private Sub txtIncomingBarcode_BeforeUpdate(Cancel As Integer)
    'This is where the Original Barcode gets placed when the employee's
    'card is scanned.
    On Error GoTo txtIncomingBarcode_BeforeUpdate_Error
    If Me.txtIncomingBarcode = vbNullString Then
    MsgBox "There must be a barcode in txtIncomingBarcode"
    End If
    On Error GoTo 0
    Exit Sub
    txtIncomingBarcode_BeforeUpdate_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure txtIncomingBarcode_BeforeUpdate of VBA Document Form_Form13"
    End Sub


    It works great to scan in the employee and pull the Employee ID from the card, But if I clear out all the fields in the form I get an error stating
    Error 94 (invailid use of null) In procedure txtIncomingBarcodeAfterUpdate of vba document form_form13.


    Any guesses as to why I am getting this? Any fixes?

    I would like to be able to clear this out so another barcode can be scanned.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    A couple of suggestions:
    Code:
    Private Sub txtIncomingBarcode_AfterUpdate()
       On Error GoTo txtIncomingBarcode_AfterUpdate_Error
       If Len(Me.txtIncomingBarcode & "") > 0 Then
          Me.txtDesiredCode = Mid([txtIncomingBarcode], 2, 6)
          Me.Test = B32toBin([txtDesiredCode], 10)
          Debug.Print Me.Test & " at " & Now()
          DoCmd.OpenForm "Consolidated Signin Form", , , "SSN ='" & Me.Test & "'"
          On Error GoTo 0
       End If
       Exit Sub
    txtIncomingBarcode_AfterUpdate_Error:
       MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure txtIncomingBarcode_AfterUpdate of VBA Document Form_Form13"
    End Sub
    Private Sub txtIncomingBarcode_BeforeUpdate(Cancel As Integer)
    'This is where the Original Barcode gets placed when the employee's
    'card is scanned.
       On Error GoTo txtIncomingBarcode_BeforeUpdate_Error
       If Me.txtIncomingBarcode = vbNullString Then
          MsgBox "There must be a barcode in txtIncomingBarcode"
          Cancel = True
       End If
       On Error GoTo 0
       Exit Sub
    txtIncomingBarcode_BeforeUpdate_Error:
       MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure txtIncomingBarcode_BeforeUpdate of VBA Document Form_Form13"
    End Sub

  3. #3
    brandonze is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    49
    Thanks, Works great.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad we could help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error 3464 Reserved Error
    By e.badin in forum Reports
    Replies: 6
    Last Post: 07-18-2011, 02:47 PM
  2. Error 13 Type Mismatch error
    By GlennBurg in forum Programming
    Replies: 1
    Last Post: 06-21-2011, 03:05 AM
  3. Replies: 8
    Last Post: 05-16-2011, 06:01 PM
  4. Error 438 error in Access 97
    By Bones in forum Access
    Replies: 3
    Last Post: 01-05-2011, 10:12 PM
  5. Replies: 2
    Last Post: 12-02-2010, 02:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums