Indentifying pressed Navigation Button
Posted on 2002-03-20
I'm using the inbuilt Navigation buttons on an Access97 form.
I have an Audit trail class module. I create an instance of this class when the form opens and reuse the same instance until the form closes.
This class basically iterates through all the controls on the form (by setting the focus unfortunately as it's the only way to get some of the properties I want) and basically stores the most pertinent properties I want in arrays private to the class.
When the user navigates to a new record in the form, the Form_Current event is used to take a snapshot of the control values using the class (i.e. it refreshes my arrays in the class).
In the Form_AfterUpdate() event, I call the class again and take a snapshot of the new values. I then compare the new values with the old values and, where different, store the array values and other properties into an Audit table.
This all works perfectly fine.
PROBLEM: The problem is that, when the Navigate Forward/Back/other buttons are pressed after a change has been made in a record, the Form_AfterUpdate() event triggers ok but, after logging the differences in my Audit table, the form does not navigate away from the changed record.
If I click the same Navigation button again, it will navigate away from the current record ok (because no change has been made and therefore the Form_AfterUpdate() event is not been triggered).
Even trying my own navigation button (Docmd.GoToRecord ,,acNext), I get the error "You can't go to the specified record").
PROBABLE CAUSE: Iterating through the form during the Form_AfterUpdate() event (well, in the class actually), setting the focus to each control.
WHAT I WANT:
Is there a way to identify which of the in-built Navigation Buttons was pressed? If I can do this, then I can use this in the Form_AfterUpdate event to force the Navigation myself after the update has been completed.
Or are there any other suggestions?