Results 1 to 2 of 2
  1. #1
    maxscott is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    5

    Post control main form navigation when sub form total does not balance


    I have a main form with a field xvalue.

    I then have a subform - each record has a field iamt. I can sum iamt for related records and this goes into txtSumAmt in main form.

    I want to prevent updates of the main tables if xvalue <> txtsumamt.

    I can stop the update on the main form using a Before Update Event with

    if me.xvalue.value<>me.txtsumamt then
    cancel=true
    exit sub
    endif


    But this won't let me go back onto the subform to edit the values of iamt.

    How can i get round this?

    Thanks

    Max

  2. #2
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,368
    You might want to put the BeforeUpdate event on the subform instead. I think either way, you'll need to invoke Me.Undo, which would roll back the changes. I presume it would be better to roll back a subform change as it's likely one control that's causing the discrepancy. Note that if you undo the main form, every change will be rolled back. If that means 10 controls, then ten it is. That's the only way I know of escaping a record change that was cancelled by the BeforeUpdate event.
    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: 3
    Last Post: 10-03-2022, 12:39 PM
  2. Replies: 3
    Last Post: 04-06-2017, 10:40 AM
  3. Replies: 2
    Last Post: 11-22-2015, 07:24 PM
  4. Replies: 8
    Last Post: 09-14-2015, 09:38 PM
  5. Replies: 1
    Last Post: 06-12-2015, 12:03 AM

Tags for this Thread

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