Code:
Private Sub btn_Ok_Click()
Dim ID As Integer
ID = DLookup("LoginID2", "Login", "Username = '" & Me.txtLoginID.Value & "'")
Tempvars!tvUserID = ID
DoCmd.OpenForm "TT Form", , , , acFormAdd
Forms![TT Form]![txtUser] = Name
End Sub
Add the line in red. After the save button code:
Code:
Docmd.close acform,me.name
docmd.open "TT Form",,,"ID=" & Tempvars!tvUserID
ID is whatever the textbox is named holding LoginID2
The reason for the Tempvar is scope. You need to hold the value of the ID so it can be used in the second procedure (which I assume is the save button).