I have a nice piece of code that I have gotten straightened out by people here, but now I need to mess it up some.
I have to take the primary key from the record that the code just added to a table and then add that to another table with information from a third field in the form.
I believe that I need to use "Bookmark.LastModified" but I am not sure how it works.
Currently the code looks like this:
Private Sub btn_AddtoTeam_Click()
Dim rst As DAO.Recordset
Dim strsql As String
Dim TNAME As String
TNAME = Forms!frm_Staff.Form!FName & " " & Forms!frm_Staff.Form!Lname
strsql = "Select Top 1 * from Team"
Set rst = CurrentDb.OpenRecordset(strsql)
![TeamName] = TNAME
End With 'rst
Set rst = Nothing
I need to take the ID number (TeamID) created by this code and add it to a second table (TeamStaff) with the staff ID on the form (StaffID).
I know that I want to bookmark the last record that was created and then pull that ID number into the next table, but I don't know how to work that into the code.
Thank you for this and for all of the help preceding this!