NearImpossible
Registered User.
- Local time
- Today, 11:33
- Joined
- Jul 12, 2019
- Messages
- 225
I have a form with a sub form and that after entering data in the sub form, a calculation query is run to update additional fields, however I am running into issues with Write Conflicts when I try to update the next field.
If I do a Me.Requery then I am able to select the next field and enter data without getting the write conflict, however after the requery, the first field on the first row is selected, which can be a pain if i'm 50 rows in, so I would like for the row where data was entered to remain selected and move to the next field in that row.
After searching the forum, I came across the following code
which I have adapted as
If I update a field on a row where there is already data, it works as intended where it is recalculated and next field in the current row is selected, however if it is the first row of a new table, then I get the following error:
Run-Time error '3021':
No Current record.
Also if I try this on a new row in an existing table, then it will go to the MaxUsers field in the previous row.
any suggestions?
If I do a Me.Requery then I am able to select the next field and enter data without getting the write conflict, however after the requery, the first field on the first row is selected, which can be a pain if i'm 50 rows in, so I would like for the row where data was entered to remain selected and move to the next field in that row.
After searching the forum, I came across the following code
Code:
Dim strBookmark As String
strBookmark = Me.Recordset.Bookmark
Me.Requery
Me.Recordset.Bookmark = strBookmark
which I have adapted as
Code:
Private Sub CurrentUsers_AfterUpdate()
Dim strBookmark As String
DoCmd.SetWarnings False
Me.Refresh
strBookmark = Me.Recordset.Bookmark
DoCmd.OpenQuery "CurrentTabletCount"
Me.Requery
Me.Recordset.Bookmark = strBookmark
Me.MaxUsers.SetFocus
End Sub
If I update a field on a row where there is already data, it works as intended where it is recalculated and next field in the current row is selected, however if it is the first row of a new table, then I get the following error:
Run-Time error '3021':
No Current record.
Also if I try this on a new row in an existing table, then it will go to the MaxUsers field in the previous row.
any suggestions?