Results 1 to 4 of 4
  1. #1
    MaSaav is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    2

    Update other table field after clicking Save button in form

    I´m working on a small database for a nonprofit to keep track of children who visit our community center, but I´m not an expert at all.



    After clicking Save button in frmDailyVisitsm, a new record is inserted into tblDailyVisits. After that I need it to do the following, but I have no idea on how to achieve it:


    1. To update the LastVisit field in tblChildren with VisitDate value from tblDailyVisits/frmDailyVisits.
    2. Calculate the difference between two dates and display a message if it´s greater than one year. These dates are stored one on each of the two tables (tblDailyVisits.Visitdate and tblChildren.LastVisit). Maybe using this expression: Int(DateDiff("d",tblChildren[LastVisit]), tblDailyVisits[Visitdate]/365.25)


    I really appreciate your help.

  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,652
    I probably wouldn't try to store last visit, but you can use a recordset to get the current value from the children table. Compare it to the value on the form, put up your message box if appropriate, and use the Edit method of the recordset to put the new value there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    MaSaav is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    2
    Paul, thank you for your response. I´m learning about recordsets to work on it and will let you know.

  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,652
    No problem, post back if you get stuck. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. only save record when clicking on a button
    By mar7632 in forum Access
    Replies: 13
    Last Post: 03-27-2019, 06:51 AM
  2. Replies: 6
    Last Post: 11-19-2017, 08:41 PM
  3. Replies: 2
    Last Post: 09-15-2015, 03:08 AM
  4. Replies: 6
    Last Post: 04-26-2013, 10:07 AM
  5. Replies: 5
    Last Post: 02-10-2010, 12:27 AM

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