Results 1 to 2 of 2
  1. #1
    ibracadabra is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    1

    Smile Automatically run update query when adding new line

    Hi everyone,

    I have a question. So I am trying to set up access to automatically run the update query when adding new record. In this sample, I wrote a query to update all Course_ID = 10 if they have Deparment_ID= 4. My question is how to let Access update automatically if I add a new row. For example, for the fifth row, if I input 4 for my deparment_id, Access itself will generate the Course_ID = 10 without me running the query. Thank you!!



    Attached is the sample file for this case.
    Attached Thumbnails Attached Thumbnails test1.PNG   test2.PNG  

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    You should not be routinely entering data into a table directly. I say routinely because one might add a few records this way for testing, but that's about it. You will need a form where its record source is the table or a query based on the table. The simplest method then would be to use the AfterUpdate event for the field you're entering 4 into so that it makes the other field = 10. You could do the reverse as well if desired. You can get help with that approach once you have the form built - unless someone gives you an idea you like better.
    Last edited by Micron; 10-19-2018 at 04:27 PM. Reason: spelin and gramur
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 4
    Last Post: 07-26-2016, 02:39 AM
  2. Update table from query automatically
    By charly.csh in forum Queries
    Replies: 12
    Last Post: 11-19-2014, 02:57 PM
  3. Replies: 10
    Last Post: 06-10-2014, 09:03 AM
  4. Replies: 5
    Last Post: 12-06-2010, 10:15 AM
  5. Help Automatically running and Update Query
    By JohnRandolphSTL in forum Queries
    Replies: 8
    Last Post: 04-13-2010, 02:08 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