Results 1 to 5 of 5
  1. #1
    agiuga is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    7

    Update query works but not when called in a form


    Hi

    I have a calculated field on a form and want to use it to update a field in a table. I have created an update query and when I run it it works taking the value from the open form.
    When I try to run the query using the DoCmd.Openquery method it doesn't work. I have also tried execute query. No errors it is just the table isn't updated after the form field is updated. I have tried refreshing and requerying the form and control. Any ideas would be great.

    I have added a button to run the query and it works. Why it doesn't as an event in the text box change event goodness knows.

  2. #2
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    this
    the table isn't updated after the form field is updated
    and this
    as an event in the text box change event

    are not supportive of each other. A form control isn't updated by the Change event. How are you executing the query from the form? What is the event and code for it?
    Last edited by Micron; 02-27-2017 at 07:23 PM. Reason: spelin
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    agiuga is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    7
    Thanks. Maybe it's a different event. I have a query which works and when the calculated field changes value on the form I want the query to run. I used DoCmd.OpenQuery "Overall Cost"
    So where or which event would I add this too.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    At the same time that the field is being calculated - that would be a good time to update the table, when a new value appears in the textbox.

  5. #5
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    the after update event

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

Similar Threads

  1. Replies: 11
    Last Post: 01-21-2014, 10:51 AM
  2. Replies: 3
    Last Post: 03-15-2012, 03:42 PM
  3. Update Query how it works
    By waqas in forum Queries
    Replies: 10
    Last Post: 09-10-2011, 11:04 AM
  4. Update Query Works Once
    By Lorlai in forum Access
    Replies: 2
    Last Post: 07-22-2011, 08:31 AM
  5. Replies: 3
    Last Post: 07-21-2010, 02:41 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