General discussion


DoCmd.OpenForm with WHERE criteria

By hgrossman ·
I have a form where people can enter a userid and password to enter the system and then have the choice of entering or changing password. The form does a DLOOKUP on USERS table to check if the userid and password combination are legit. If they choose change password, I have the following code (I save the userid and group in global variables for other usage):

userloggedin = Me.UseridPrompt.Value
usergrouploggedin = DLookup("UserGroup", "Users", _
"[Userid]=""" & Me.UseridPrompt.Value & """")
DoCmd.Close acForm, "Volunteer Login Page", acSaveNo
stLinkCriteria = "[Userid] = '" & userloggedin & "'"
DoCmd.OpenForm "Volunteer Change Password", , , stLinkCriteria

The Change Password form has 3 fields on it - Userid which is bound to USERS and 2 unbound fields for new password. The Userid field is not Enabled as I don't want anybody typing there - I just want to display the Userid. When it opens the Change Password form, it does not display the contents of the Userid field but, rather leaves it blank. What do I have to do to get it to display the Userid field for the individual that logged in?


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

I hope this can help you

by adiaz1 In reply to DoCmd.OpenForm with WHERE ...

If you want to Displays the value of the Userid field in the Users table
Try this

usergrouploggedin = DLookup("Userid", "Users", _
"[Userid]='" & Me.UseridPrompt.Value & "'")

Related Discussions

Related Forums