Creating a Response Form from User Login Details

macftm

Registered User.
Local time
Today, 08:27
Joined
Aug 31, 2011
Messages
31
Hi,
I am creating a database which will allow users to enter a numerical response to a series of statements.

This form will have the users name and department located on it automatically once the user has logged in.
I have create a table containing the user details e.g. username, password, name and department.

I have another table which will hold the returned values for each statement the user must rank.

In addition to this, I have a user verification form, which check the user's username and password correctly, and will only open the response form once their details have been verified. The code form this is shown below:

Private Sub btn_Search_Click()
Dim sUser As String
Dim sPassword As String

sUser = Me.txtUserName
sPassword = Me.txtPassword

If DCount("*", "T_User_Information", "UserName = '" & sUser & "' And Password = '" & sPassword & "'") = 0 Then
MsgBox "Incorrect User Details! Please re-enter your username and password", vbExclamation, ""
Else
DoCmd.OpenForm "Navigation Form1"
End If
End Sub


The problem I am having at the moment is that once a user has been verified, the form brings back the details for the same user, regardless of the user’s details which have been entered.

Can anyone help suggest a way I can get the response form to link up with each user?
 
Last edited:
Thanks for that.

I am getting a complier error related to the ControlName section of the code.

Can I just check if i'm doing this correct.

I wants to display the person's First Name (FirstName) from the table T_User_Information.

Should the code be as follows:

DoCmd.OpenForm "Navigation Form1", , , "UserName = '" & Me.ControlName & "'"
 
ControlName needs to be the name of the control (text box, combo, etc) containing the user name.
 
Sorry pbaldy, I've worked that part out now and have the following code:

DoCmd.OpenForm "Navigation Form1", , , "UserName = '" & Me.txtUserName & "'"

This is linking the unbounded username textbox on the user verification form the the bounded username textbox on the navigation form (bound to the table T_User_Information, field name: UserName).

Unfortunately, I’m still getting the same users response form, regardless of the users details I enter.
 
Can you post the db here, or a representative sample?
 
I've attached the DB. The forms you need to look at are: F_User_Search and Navigation Form1.

The usernames and password required for the verification form (F_User_Search) can be found in the table T_User_Information
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom