Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2012

    Unanswered: Macro / Update Query Fun!

    Help! I have created an update query which is designed so that when someone enters a choice on my main form (linked to master table) it puts a price and cost in two other fields in the table/form.

    I built the query and it runs fine from design view updating values in the tables. However I then built a macro to run the query and attached it to the 'after update' of another field. HOWEVER!

    As soon as a trigger the macro it works once then after that it still comes up with all the normal warning messages (do you want to update...) but then it does nothing AND when you reopen the query in design view it has removed all the fields from the query except the 2 calculation fields!

    I've also tried using a bit of VB code to run the query with similar results. I'm also getting a pop up box saying 'Write Conflict, This record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes the other user made...'

    I don't know whether this is linked? Can any help!?

  2. #2
    Join Date
    Jan 2012
    Its fairly difficult to attempt to find a solution to your question without being able to view the SQL for the query or the code behind the macro. Is it possible to post both of these here? You also refer to a 'choice', is this a combo box control? Also what is the 'other field' you refer to?
    Hope this helps,



    Access 2000 User

  3. #3
    Join Date
    Jan 2012
    Hi maybe it's easier if I post a blank version of the db on here so you can see the mechanics. I've altered the data so it's not accurate but the mechanics should all work ok. Thanks
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    my first guess would be it shouldnt' happen in the forms after update event. that happens AFTER the update, so Im guessing what its actually doing is updating a new record

    Im not sure what you are doing precisely
    but I suspect you need to call this macro from sevearl events
    the on current (to set values when you navigate to a new record
    the on change event for each relevant control
    the on lost focus event for each relevant control

    understanding the even model in Access is crucial to understanding where to place such fragments of code. if yuy are unsure then I'd suggest putting a msg box behind each event ahd see what happens when you go through the events
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts