Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Okay - that wasn't clear from the pictures, it looked like a relatively simple string concatenations without seeing the underlying machinations.


    Based on the Form.Undo (it does state it runs before changes are undone on a form) not helping, here's a leftfield possible use - in the form.undo set a form timer event to do the recalc after 1/2 a second? then turn it back off?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  2. #17
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    @Minty, post #16 Look at Hernandez in the Name 4 field and how it's shown in the calculated text box (post #9). Notice how the two calculated textboxes appear based on the same name data.

    Using a timer might be a good idea. I've used timers to test if an administrator wants to shut down all forms/updates/reports for some BIG reason.
    During development, I turn timers off, so that slipped my mind. The best way is to set some kind of form flag modular variable that an undo was done, and then do all the logic. The overhead to just review a flag every so often shouldn't be too much of a burden. If I can't find a procedure for after undo that is. On the downside, I only run timers every 15 or so seconds, so I'm not sure if users are going to accept that kind of delay (average 7 seconds) after an undo to see the impact.

    Likewise, I could add the same checking logic for every field on the form (calling a centralized procedure) so that entering or leaving any field would trigger the recalc. However, this kind of work around drives me nuts when working with Access. Shouldn't have to be. Knowing a value before undo can be useful, but doing something after an undo seems more probable in real applications.
    Last edited by twgonder; 08-29-2023 at 06:22 PM. Reason: Somehow posted when not ready, twitchy mouse

  3. #18
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    I would only turn the timer on in the form.undo event, then turn it back off once it's been triggered.
    That way there is no overhead if the undo isn't ever pressed, and it's only on for a very brief time so it doesn't interfere with anything else.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #19
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    How are you invoking the undo? If your using the escape key or control + z, you could try capturing the keystrokes and run your code from there.
    Code:
    Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    'set form keyPreview to yes
    
    
        If KeyCode = vbKeyEscape Then
            
            'run your code
            
        ElseIf KeyCode = vbKeyControl And Shift = 2 Then
            
            'run your code
            
        End If
    
    
    End Sub
    You can also do it by specific controls instead of form. You'll need to experiment.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #20
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    @moke123, post #19 Thanks for that code and idea. I'm still trying to figure out how esc and ctrl+z are supposed to work. Every time I use them, as best as I can recall, I get different results. I'm sure I've seen it undo just the most recent change, with one entry of esc or ctrl+z, and now it seems to do all on the first press. I hate to modify "normal" things that Access does, so as not to confuse seasoned users that have a pattern. (hands thrown up in the air)

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query runs before On Open Event Procedure
    By shuddle in forum Access
    Replies: 3
    Last Post: 12-21-2016, 01:36 PM
  2. Undo in form and subform
    By azhar2006 in forum Forms
    Replies: 7
    Last Post: 09-05-2014, 09:04 AM
  3. Replies: 2
    Last Post: 03-28-2014, 11:25 AM
  4. Need Help: Form Undo Error
    By RichardAnderson in forum Forms
    Replies: 1
    Last Post: 10-10-2013, 12:41 PM
  5. Replies: 4
    Last Post: 07-30-2013, 02:07 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