Thanks for actually reading the OP for me andrew,
For this example I used frmStudent as form1 and frmTeacher as form2
This works:
First make a module, and insert code like this:
Code:
Global gbLastRec As Integer
Sub lastRec(intLastRec As Integer)
gbLastRec = intLastRec
End Sub
Now, for form 1 use code like this:
Code:
Private Sub cmdForm2_Click()
Call lastRec(txtStudentID)
DoCmd.OpenForm "frmTeacher"
Forms("frmTeacher").SetFocus
DoCmd.Close acForm, "frmStudent"
End Sub
In this form, txtStudentID hold the primary key for the table to which the form is bound. The global variable gbLastRec will get assigned this ID value for later reference.
Now in form2, use code like this:
Code:
Private Sub cmdForm1_Click()
DoCmd.OpenForm "frmStudent"
Forms("frmStudent").SetFocus
DoCmd.Close acForm, "frmTeacher"
DoCmd.GoToRecord acDataForm, "frmStudent", acGoTo, gbLastRec
End Sub
So, when you click the button in form 2, it is closed, form 1 is opened, and then it goes to the record you saved as gbLastRec.
Edit:
The OP managed to squeeze in a post while I was writing this, I'm looking over it now. As is, I guess this reply is to andrew regarding how to go the last record you were on, on a form.