Results 1 to 11 of 11
  1. #1
    harhar0506 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2017
    Posts
    11

    Search... and Add Record again problem

    I have a Table with 50 records, I would like to search a record, say Record B using Form. After the record is shown, I want to add the time of recording, and then save it as the 51st record in the Table. How can I do this?


    Help! Please give a hand. Thanks!

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Please explain why you are adding the same record again. If the only difference is the time of recording, that needs to be stored on a separate table linked to the primary key of the table containing the "master" data.

  3. #3
    harhar0506 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2017
    Posts
    11
    Quote Originally Posted by aytee111 View Post
    Please explain why you are adding the same record again. If the only difference is the time of recording, that needs to be stored on a separate table linked to the primary key of the table containing the "master" data.
    Actually, I'm making a database for logging students time when they get their lunch. however, some may use the same identity twice, so, I hope I can record the time(s) which the student got his lunch through Form. When he comes again, I then know he got already.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    What is the form process? Is the time entered automatically? Explain how the student uses the form.

    At some point you will run an append query to append a new record to the table. I am trying to find out at what point this will happen, after the user has finished doing what they need to do.

  5. #5
    harhar0506 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2017
    Posts
    11
    The form is made for the helper. The whole process is like this:

    Student A go to a counter and show his student card with barcode, the helper then scans the barcode to read his order record and I hope that the database can save the time he got his lunch. When another student B got the same student card and want to get a lunch set. When the helper scans his card, then from the Form view, he can identify the card being used already.

    Hope that this helps.

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You have a table of students. The helper scans their ID and a new record is added to a time table with the student ID and the date and time, and anything else required.

    A second student arrives, the helper scans their ID - what do you want to happen? To check to see if this student has already been scanned with today's date and give an error?

  7. #7
    harhar0506 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2017
    Posts
    11
    aytee111,

    Yes, exactly! Just let the helper see the time(s) the card scanned or a warning info for the helper. if the card did not use on that day, there should be students info and no warning message or time either.

  8. #8
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The code to check whether an ID has been used today is:

    Code:
    If DLookup("Format(DTLogged,'Short Date')", "Table1", "StudentID='" & Me!StudentID) = Format(Date, "Short Date") Then
       ...this ID has been used today
    Else
       ...add a new record to the table
    End If

  9. #9
    harhar0506 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2017
    Posts
    11
    Thanks, aytee111.

    But I'm really new in programming... Where should I use this macro?

  10. #10
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You have a form which the helper is using to enter the student's ID. As soon as it has been entered, in the AfterUpdate property click on the three dots and add an Event Procedure. Copy the code into that subroutine.

    If you are so new, you may need further code. Let me know exactly what you want to occur - 1 if the ID has been used already today and 2 if it hasn't been used today

  11. #11
    harhar0506 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2017
    Posts
    11
    I prefer 1. I can try this tmr morning. And let you know the result asap. Thanks! ^^

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

Similar Threads

  1. Search all for data containing....problem.
    By ShawnCartwright in forum Programming
    Replies: 2
    Last Post: 08-14-2013, 10:50 AM
  2. Replies: 7
    Last Post: 08-08-2012, 03:28 PM
  3. Replies: 1
    Last Post: 04-09-2012, 02:14 PM
  4. Search Problem
    By martyloo in forum Access
    Replies: 1
    Last Post: 09-30-2011, 02:55 PM
  5. Problem in Search Form
    By siddel77 in forum Forms
    Replies: 1
    Last Post: 09-05-2011, 06:29 PM

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