Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Recordset Problem (Acc 97 sr2 on 95b)

    Oh great gurus of the database!!

    (ok, enough crawling)

    I am trying to set up a barcode system. I don't actually have one yet, but I am assuming that the software to drive it will issue a tab or enter command after the code.

    My problem is: I have a form and a table (see attached db). The idea is that an employee will wand his card which will be entered into txtBarcode. On exit or loss of focus or whatever (at the moment, press tab) the code should open a recordset on the table, find the matching record , read the status value, and act on it, but the code is bombing out on the .FindFirst command.

    Can someone please solve this for me, I thought it was within my realm of knowledge
    Attached Files Attached Files
    "Heading for the deep end"

  2. #2
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Recordset Problem (Acc 97 sr2 on 95b)

    G'Day,
    Try this bit of code on the 'After Update' Property and let me know if it works. Basically, if it finds a match, it changes the 'Status' value from Yes to No or No to Yes.

    On Error Resume Next
    DoCmd.SetWarnings False
    DoCmd.RunSQL "UPDATE tblHere SET tblHere.Status = IIf([status]=Yes,No,Yes) WHERE (((tblHere.EmpID)=[Forms]![frmBarCode]![txtBarcode]));"
    DoCmd.SetWarnings True

    As far as enabling the command buttons, I would try a DLookup to initiate that portion of the code. I hope that helps.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Recordset Problem (Acc 97 sr2 on 95b)

    THANKYOU!! (That's step 1 of my master plan accomplished [sounds of evil, maniacal laughter])

    I see I am going to have to get my head around the concept of 1 line SQL's
    "Heading for the deep end"

  4. #4
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Recordset Problem (Acc 97 sr2 on 95b)

    This code can be used to run the lookup and perform the functions you want to run. Give it a whirl and hopefully it will help:

    Dim MyAnswer As Variant
    MyAnswer = DLookup("[Status]", "tblHere", "[EmpId]='" & Me.txtBarcode & "'")
    If IsNull(MyAnswer) = True Then
    cmdClockOn.Enabled = True
    Else
    MsgBox MyAnswer 'Just to illustrate that the DLookup is functioning properly - delete later.
    cmdStartJob.Enabled = True
    End If

Posting Permissions

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