Results 1 to 3 of 3
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658

    What procedure if record moves without being dirty


    I have a subform with multiple records displayed.
    I've tried to find a way to run some procedure code if the record hasn't been changed (not dirty)
    and before control is moved to another record.
    I want to avoid making the record dirty at the start (current) so as to force the record's beforeupdate (this would cause other problems).
    I've looked and tried, but I can't find an event (or other way) to do this.

    Another solution is to find a way that a user can't click off the current record (I have buttons for moving between records), but I'm not sure how to do this either.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    The only thing I can think of is if you can control which form control has the focus at that point, you could use its Exit event. For that matter, perhaps all or any controls in the record as you see fit. The advantage would be that the exit event can be cancelled, thus keeping user in that control if that's how you code it. That seems to satisfy this if it's another goal
    find a way that a user can't click off the current record
    Red part is like your "other code"
    Private Sub Entry_Exit(Cancel As Integer)
    If Me.Dirty = False Then MsgBox "not dirty"
    End Sub
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    @ Micron post #2 I'll look into Exit even. I'm not sure how to tell if the entry control exiting because of moving to another control on the same record, or a control on another clicked record.

    For those that care and for grins, I tried the forced dirty approach by setting a record field in the subform to a dummy value in the Form_Current procedure. With only two records in the subform, this caused Access to run the Form_BeforeUpdate procedure 9 times even before the form was displayed. Very curious behavior!

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

Similar Threads

  1. Replies: 3
    Last Post: 06-25-2019, 03:41 AM
  2. Replies: 6
    Last Post: 05-26-2019, 04:32 AM
  3. Replies: 5
    Last Post: 08-18-2018, 10:23 AM
  4. Not In List Moves To Next Record
    By Derrick T. Davidson in forum Programming
    Replies: 2
    Last Post: 01-16-2016, 12:46 AM
  5. Using Me.Dirty in a BeforeUpdate event procedure.
    By MatthewGrace in forum Programming
    Replies: 3
    Last Post: 11-30-2014, 12:40 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