Hey guys,
I'm designing a user details form. It's going to have all of the data stored about the user.
I'm trying to load a form, and upon loading it will populate the text boxes with the already stored data. LoginID is the criteria I'm using here as it is unique to all users. Once the user logs in, it assigns a value to LoginID (which is a public variable). Then when they open the account details form it will use that LoginID to search against their stored data in tblUserDetails.
The issue I'm having is that no matter which user logs in, it will always only show one of the user's details everytime. I've made sure that LoginID is definitley changing each time by changing a label to the value.
Any help will be appreciated, here is the code:
I'm designing a user details form. It's going to have all of the data stored about the user.
I'm trying to load a form, and upon loading it will populate the text boxes with the already stored data. LoginID is the criteria I'm using here as it is unique to all users. Once the user logs in, it assigns a value to LoginID (which is a public variable). Then when they open the account details form it will use that LoginID to search against their stored data in tblUserDetails.
The issue I'm having is that no matter which user logs in, it will always only show one of the user's details everytime. I've made sure that LoginID is definitley changing each time by changing a label to the value.
Any help will be appreciated, here is the code:
Code:
Private Sub Form_Load()
Me.lblComplete.Visible = False
Me.lblInfo.Caption = LoginID
Me.txtForename = DLookup("FirstName", "tblUserDetails", "LoginID = LoginID")
Me.txtSurname = DLookup("LastName", "tblUserDetails", "LoginID = LoginID")
Me.txtHouseNum = DLookup("HouseNumber", "tblUserDetails", "LoginID = LoginID")
Me.txtStreet = DLookup("StreetName", "tblUserDetails", "LoginID = LoginID")
Me.txtCity = DLookup("City", "tblUserDetails", "LoginID = LoginID")
Me.txtPostCode = DLookup("PostCode", "tblUserDetails", "LoginID = LoginID")
Me.txtMobileNum = DLookup("MobileNum", "tblUserDetails", "LoginID = LoginID")
Me.txtEmail = DLookup("Email", "tblUserDetails", "LoginID = LoginID")
Me.txtCardNum = DLookup("CardNum", "tblUserDetails", "LoginID = LoginID")
Me.txtExpiry = DLookup("ExpiryDate", "tblUserDetails", "LoginID = LoginID")
Me.txtSecurity = DLookup("SecurityCode", "tblUserDetails", "LoginID = LoginID")
Me.txtRemarks = DLookup("Remarks", "tblUserDetails", "LoginID = LoginID")
End Sub