Login Forms, with user name and password

NewfieSarah

Registered User.
Local time
Yesterday, 20:43
Joined
Feb 11, 2005
Messages
193
I have created a login form, with a user name and password. It works great. However I need to use the login form for three different command buttons, on my main access form. The same login form will be used but It will need to open three different forms depending on what command button was selected on the main page.

Main page- PID
3 command buttons- building, documents, assessments
login form- login
3 documents- build, docs,assess

I open main page, PID- click on buildings the login form pops up and I enter the correct username and password the building doc opens. Got it?? The same process for each, I would like to know how is this possible? How do I change the differnt documet that opends according to the command button that has been pushed? :confused: Thanks in advance
 
This can be accomplished very easily. I would create a public "flag". When flag is 1, open building, 2-open doc and 3-open assessments.

Clicking a command button on your main page not only opens up the login form, it also sets the flag. For example, clicking on buildings will open the login form and set "flag" to 1. Then within the login form, before opening the appropriate document, check the flag, if flag = 1 then open the building doc. Get it??

Life goes on!!!!
 
Humm no not really. I do undsertand the concept. Not how to actually create it. I have never heard of flags before?? Can you help me out a bit further with this. So where do I put the flags, and how are they coded?? HUMM
 
Awsome, thanks for the help. That is just what I needed. You are a life saver! Thanks! :)
 
I used the code, In that example, and it worked till I have to link my table to my database, my Tables are in another database, and I have a link to it in this database. I dont think that that code looks for the correct userid and password. It just chooses the first one, does it look through the whole table? That is what I need. I added the record user-1234 pass-2005 and I got a type mismatch. for this line. Help!
If Me.Password.Value = DLookup("Password", "Access", "[UserId]=" & Me.User.Value) Then
This is located in the Submit button on the login form.
The whole code
'Check value of password in tblaccess to see if this matches value chosen in text box
'checking what flag is in place to see what form needs to be loaded
If Me.Password.Value = DLookup("Password", "Access", "[UserId]=" & Me.User.Value) Then
CheckFlag
DoCmd.close acForm, "IDForm"
Else
DoCmd.OpenForm "MSG Form"
End If
 
I have not looked at the above sample but if you are using a database password or access security then...

Deleting the linked tables then relinking them should fix your problem. The relinking of the tables will store the login info but in a way that the user will not know what it is.
 
Here is the syntax of DLookup:
= DLookup("[ColumnName]", "TableOrQueryName", "[CriteriaControlName] = something")

and notice that your linked table's name is tblaccess (from your comments), not Access as shown in your code.
 
Hi I am not common with the DLookup, so I am not stuck with it. I would just like to search my database for the correct password and user name, for the login form. Any more ideas. This DLookup worked till I added the flags. Thanks
 
I have been looking thru the forum to find a way to password protect a form using a table holding the User ID and Password the solution by Supercharge works brilliantly if anyone else is looking for a similar solution, i adapted it slightly so it works from a button on the switchboard...cheers Supercharge
 

Users who are viewing this thread

Back
Top Bottom