Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2015
    Posts
    5

    Unanswered: Referencing the result from a SearchRecord

    Hi,

    I have a form that pulls data from a read only external table. To be precise, a barcode is scanned, and Names and ID # corresponding to that barcode is pulled from the external table and displayed on the form. The form has some other check-box options to track certain training activities. The form saves data to a table local to the database. Here is the issue:
    Suppose person A's barcode is scanned and his name and ID are pulled up, and I then check 'check-box 1' ON and the data is saved to the local table. At a later instant, person A's barcode is scanned again, and this time 'checkbox-2' is checked ON. This creates another entry/row in the local table. Is there a way to add the new data (checkbox-2) to the existing row for person A? An idea I have is to do a SearchRecord and then check if person A is already in the local table. If so, use some code to link the check-boxes to the corresponding fields in that row. However, I am not sure how to reference a search result (or match) in VBA. Is this a good approach? Could someone help me with this?

    Thanks

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    You don't need vba. The local table should join the master table on the ID.
    ID# 123,
    Should have 2 records. Chbox1 and ChkBox2, each value either true/false.
    Or
    Add chkBox2 to the 1 record in the local table. As:
    [id],chk1,chk2
    123, true,false

  3. #3
    Join Date
    Nov 2015
    Posts
    5
    Quote Originally Posted by ranman256 View Post
    Add chkBox2 to the 1 record in the local table. As:
    [id],chk1,chk2
    123, true,false
    Hi, Thanks for your reply but I did not quite understand what you said. If ID 123 is already in the local table (with checkbox-1 = ON and checkbox-2 = OFF), and later I check checkbox-2 ON, how can I link it to the checkbox-2 cell corresponding to ID 123's already existing row in the table?

    Thanks!

  4. #4
    Join Date
    Nov 2016
    Posts
    3

    Lookup record before creating new record.

    the source table for the form (that gets populated) should have fields for these checkboxes. In fact, any editable field should reference a field on that table). If this is already the case, read on...

    When a record is scanned, you should be doing a lookup first, if that record (barcode) is not found, I would suggest a prompt for new record (that is how I have done it in the past).

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
  •