Results 1 to 3 of 3
  1. #1
    NickWren is offline Advanced Beginner
    Windows XP Access 2013
    Join Date
    Dec 2015
    Location
    Connecticut
    Posts
    70

    Need VBA Help

    I am trying to program a barcode system in my database for a easy way to log in samples.


    I have a field called Text18 this is where barcode is scanned in. I want to be able to click on that field and just scan sample after sample. (or idk if possible have an invisible field where you can just scan into)
    Scanning in the Sample will just give a time stamp for that step in our process (pretty much marking that we did it).

    So once the scan is done (the barcode gives us back our id's (ex. PL-0001-NT)) our ID is entered into Text18 via barcode scanning. Now I want to do the next sample, but the last sample wont updated until I hit enter/tab. How can I not only enter/tab the sample, but have it clear and start back at Text18 ready to enter the next sample.

    Code:
    Private Sub Text18_Change()
    Barcode = Text18.Value
    LenBarcode = Len(Barcode)
    If LenBarcode <= 10 Then
    Me.Requery
    Me.BloodProcess.Value = True
    Me.DateBloodProcess = Date
    Me.StartTimeBloodProcess = Time
    Me.BloodProcessedIntials.Value = Text5.Value
    DoCmd.Save
    ElseIf LenBarcode > 10 Then
    Me.Text18 = ""
    End If
    End Sub

  2. #2
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Not sure about your barcode reader. but mine has a hardware options to setup what key codes are sent when scanning. You can use this to change the input into the database. Or if your barcode send a carriage return after every scan, go into the keypress event for the field, and look for keyascii = vbcrlf. This would trap when that is pressed. Keyascii is byref, so you can set it to 0 and then it would act like carriage return was never pressed.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Have you thought about not using a bound form and instead using your vba to append a record to your table then displaying the record, or if you're determined to use a bound form force a me.refresh after you set the bloodprocessed initials, I'm not sure that would give you what you want but on bound forms sometimes you have to force a me.refresh or a me.requery to get the results you want.

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

Tags for this Thread

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