DoCmd.OpenForm with WHERE criteria - TechRepublic
General discussion
April 9, 2008 at 08:14 AM
hgrossman

DoCmd.OpenForm with WHERE criteria

by hgrossman . Updated 18 years, 3 months ago

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?

Thanks.

This discussion is locked

All Comments