I am using access 2000 and having problems pointing to a specific recored on a subform.

I have a main form and subform(located on the main form) both pointing to the same table. Both main and subform are used to input data into the same table. I know you're wondering why don't I just put them together on a single form, right? Well, I have 4 subforms on that main form and depending on early selections by the user 1 of the 4 subform becomes visible.

Now, when the main form opens it is already pointing to a new record. I put a text box on both the main and subform which points to the primary key of the table (autonumber) so I could see what record it was currently on.

Once you start inputing data in the text boxes on the main form the AutoNumber textbox located on the main form automatically changes to (Example) 95 as you're entering data into the new record with the new primary key 95.

Then, once I move to the subform area located on the main form and start entering data into those textboxes the AutoNumber text box located on the subform section populates with 96 meaning you're putting it into a new record again which I don't want. I want the subform data to be inputted into the same record as the main form which was 95.

I tried changing the Cycle properties of the forms to Current Record, but that didn't work.

Another thing I tried was putting the following code into an Enter event for the subform so when the subform receives focus I could move the record to match the main form and not have it inputted into a new record again.

However, with all the codes below I would receive an error saying "You can't go to the specified record."

Any thoughts?

VB Code:
  1. 'Test1
  2. DoCmd.GoToRecord , , acLast
  3.  
  4. 'Test2
  5. DoCmd.GoToRecord , , acNewRec
  6. DoCmd.GoToRecord , , acPrevious
  7.  
  8. 'Test3
  9. Do Until frmSub.txtPrimaryKey = frmMain.txtPrimaryKey
  10. DoCmd.GoToRecord , , acNext
  11. Loop
  12.  
  13. 'Test4
  14. Do Until frmSub.txtPrimaryKey = frmMain.txtPrimaryKey
  15. DoCmd.GoToRecord , , acPrevious
  16. Loop
  17.  
  18. 'Test5
  19. DoCmd.GoToRecord , , acGoTo, frmMain.txtPrimaryKey
  20.  
  21. 'Test6
  22. DoCmd.GoToRecord  , , acGoTo, frmMain.txtPrimaryKey-1