Results 1 to 11 of 11
  1. #1
    jcaptchaos2 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    36

    Form Help

    Hello,

    I am using this code to pull the shift number from one table to another when and employee scans there ID, I am wondering if I could also use something like this to have a box pop up when they scan saying something like "Transaction accepted Bob" or what ever their name is. The name is in the same table and the field name is [Employeename]
    Code:
    Private Sub Employee_Number_AfterUpdate()
    shift = DLookup("[Shift]", "[employeetbl]", "[Employee #]= " & [Forms]![ParollTimeofffrm]![EmployeeNumber])
    End Sub
    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Sure; you can look up the name the same way (a recordset would be more efficient for multiple values), and then

    MsgBox "Transaction accepted " & YourVariableName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jcaptchaos2 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    36
    Thanks, would I create a text box and then use the MsgBox code it that, this info would not need to be stored in any table it would just let them know that the transaction went through.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You can use a textbox, but you don't need to. You can use a variable as in my first example or just:

    MsgBox "Transaction accepted " & DLookup(...)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    jcaptchaos2 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    36
    Where do I place this code?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Wherever you want the message. You mentioned when they scan, so that same after update event is a likely candidate.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    jcaptchaos2 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    36
    Thanks pbaldy

  8. #8
    jcaptchaos2 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    36
    Ok tried this but it errors out on the MsgBox part. I want to be able to have it so after the employee scans thier badge it acknowledges it by saying Transacted Accepted and then thier name. The only thing they do is scan thier badge on this form so I don't know where else to put the code other that with the shift code.
    Code:
    Private Sub EmployeeNumber_AfterUpdate()
    shift = DLookup("shift", "employeetbl", "employeeNumber=" & EmployeeNumber)
    MsgBox "Transaction accepted " & DLookup("Employee Name", "employeetbl", "employeeNumber=" & EmployeeNumber)
    End Sub

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You probably need to bracket the field name due to the inadvisable space:

    [Employee Name]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    jcaptchaos2 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    36
    You are correct Sir, thank you for your continued help: )

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    No problem, glad it worked for you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

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