Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2014
    Posts
    1

    Lightbulb Unanswered: Code to Compare Fields and Insert Current Date/Time If Equal

    Hi All-

    I work as the sole help desk/PC tech at my workplace. Every so often we take old hardware to recycling but it has to go through a specific administrative/approval process. I am assigning a unique identifier to each piece of hardware which is used as my primary key.

    I am using a bar code scanner which treats input as keystrokes. Right now the scanner isn't entering in carriage returns after the input but I can modify its configuration if needed.

    Basically, when an item comes in, I manually enter the date and time into a field when I create the record of the item.

    However, when I add an item to our worthless memo, I want to be able to scan the barcode of the item, have Access check the scanned barcode identifier against the identifier already in the record. If they match, it will insert the current date and time. (10/15/14 2:17:00 PM). If they don't match it should throw a dialog box stating ID mismatch. Attached is a screenshot of the data entry form for a better idea.

    Click image for larger version. 

Name:	access_help.png 
Views:	7 
Size:	44.0 KB 
ID:	15908

    I took one course in Java years ago for my undergrad but am not a programmer at all. I didn't know if someone would be able to help. Thanks in advance, I know it is somewhat complex (or seems so to me).

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    Is this what yr talking about?...

    Code:
    txtScan = ScanABarCode()   'scanned bar code entry to txt box
    
    'now see if it exists
    txtSerial =  Dlookup("[ID]","table","[id]='" & txtScan & "'") & ""
    
    if txtSerial = "" then 
       msgbox "NOT FOUND"
    endif

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
  •