I have three forms. All are connected to tblComp.
1. frmMain
2. frmSelect (subform embedded in main form) - read-only as Datasheet
3. frmRecords (popup form) - editable
I'm looking to add a new record from clicking a button on frmMain, which creates a new record in frmRecords with only the primary key (RV_ID) populated. I need the new record to be a new incremental value for RV_ID by finding the highest value of RV_ID in tblComp and adding 1 (presumably using DMax).
I've tried several different methods based on other posts with no luck (getting the error 2105 - "You can't go to the specified record". Below is my current code, any guidance/suggestions would be greatly appreciated.
Code:
DoCmd.OpenForm "frmRecords"
DoCmd.GoToRecord , , acNewRec
[RV_ID] = Nz(DMax("RV_ID", "tblComp") + 1)