Question

My issue which is very perplexing is that I have a form which has an on-current event updating it's underlying table with some SQL queries every time the user selects one of it's records. All works fine until the end of the routine where i need to add some VBA code which will move the selected record from the one the user had selected to the following record (or the first record if the user had selected the last record in the recordset). Very strangely, upon adding the code below, the execution of the on-current event becomes a continuous loop type event forcing me to have to CTRL-ALT Delete and manually close Access. For me it is strange, my instruction is simple and in theory should bring the user to the next record instead of executing an infinite query.

If CurrentRecord = Recordset.RecordCount And CurrentRecord <> 1 Then
    DoCmd.GoToRecord , "", acFirst

Else
    DoCmd.GoToRecord , "", acNext

End If
Was it helpful?

Solution

The problem was resolved by separating the update table queries from the GoToRecord if clause. In essence, i left all the update queries on the 'On Curren' event for the form and took the If Clause (above) and attached it to the 'after update' event for the form. It works fine now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top