i created a login page with 2 fields txtLoginID and txtpassword
When i press ok if the user name and password is correct i open the form [TT form] i push the username for that particular ID to the field me.txtusername on form [TT Form]
Code:
Private Sub btn_Ok_Click()
Dim ID As Integer
ID = DLookup("LoginID2", "Login", "Username = '" & Me.txtLoginID.Value & "'")
DoCmd.OpenForm "TT Form", , , , acFormAdd
Forms![TT Form]![txtUser] = Name
End Sub
This works fine intially however the form [TT Form] is used to create new records and has a save button which saves the record if all fields have been filled.
Since it is used to add records after executing the save command. it clears all fields including the me.txtusername.
I want the username of the person logged in to still be displayed until the user logs out.
Also there is a 2nd form [Edit] where you can update the existing TT that have been created. You i have a button to take you back to TT form to create a new record
I want the name of the person who is logged in to be displayed on the TT form in me.txtusername every time after a ticket is lodged or the TT form page is opened.
So basically i want to
1. save the value of me.txtusername and display the same value in the same text field in the new record.
2. if i go to update field i would want to save the value of me.txtusername and when i open TTform from the update form to again display the value