First post so hoping this makes some sense. I’m adding data to tables from unbound text boxes using a command button and the .AddNew method. The form itself is still bound at this point. FYI, I’m using unbound boxes as the UI needed for junction tbls was not an option. I’m able to add the data to the tables without a problem. The issue is that after adding a record, the form’s current record stays on the same record as before the addition but I want it to be on the new record. I’m using “rst.Bookmark = rst.LastModified” to set the cursor to the new record in the table and seems to work as I can return values for the new record ... but this does not affect the form. I’ve tried working with “Requery” and “CurrentRecord” but neither resolves the issue.
In summary, after adding a new record to a table I want the form’s current record to reference this new record. For example, if I am on record 12 in the form and add a new record bringing the total records to 25 -- I want the form to be on record "25 of 25" not on "12 of 25". Can you tell me how to do this? Thanks for your help!
With rst
.AddNew
!Event = Forms!MainForm!Event
!DonorName = Forms!MainForm!DonorName
!EnvNo = Forms!MainForm!EnvNo
.Update
.MoveLast
.MoveFirst
End With
rst.Bookmark = rst.LastModified
''' Record count total - show on form - confirmed/same as Access Navigation display
Forms!MainForm!txtTotalRec.Value = rst.RecordCount
''' Current Record - show on form - confirmed/same as Access Navigation display
lngCurrent = Forms!MainForm.CurrentRecord
Forms!MainForm!txtCurrRec.Value = lngCurrent