Creating User Login Screen (1 Viewer)

Joe B.

Registered User.
Local time
Yesterday, 21:32
Joined
Mar 16, 2012
Messages
34
Is there a way to get a user login form to open when the user clicks on their desktop icon for the application? Right now the database opens when the destop icon is clicked.

Thanks very much for you help.

Joe B.
 

mdlueck

Sr. Application Developer
Local time
Yesterday, 21:32
Joined
Jun 23, 2011
Messages
2,631
Sure:
1) Create a form which gathers login credentials
2) Create a Macro named autoexec which opens said form
3) Exit / Reopen the database to test the results
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:32
Joined
Aug 30, 2003
Messages
36,127
In place of #2, you can set it up as the startup form in Tools/Startup or Access Options, depending on your version.
 

Micromax

Registered User.
Local time
Yesterday, 21:32
Joined
Mar 3, 2012
Messages
35
Hi this code I have may cause the user to enter a password which is stored in a table. The only problemis that the user can open the database objects. I have not figured that out as of yet.

Here is the code for the users form where a combo box has the user names and they have to type in the correct password.

Private Sub cmdLogin_Click()
If UserPassword = DLookup("UserPassword", "tblUsers", "[UserID] = " & Forms![frmUsers]!cboUserName.Column(0)) Then
Beep
Beep
DoCmd.Close acForm, Me.Name
Else
MsgBox "Wrong Password-Try again"
UserPassword = ""
UserPassword.SetFocus
End If
End Sub

If this form can be the Start up form, perhaps there is a way that the database wndow will not be displayed? I haven't figured that out yet.

Rob
 
Last edited:

mdlueck

Sr. Application Developer
Local time
Yesterday, 21:32
Joined
Jun 23, 2011
Messages
2,631
This code I have may cause the user to enter a password which is stored in a table.

BTW: I use a scramble / unscramble algorithm on my passwords when I store them. I use a simple conversion on each character, so the result is unreadable to the human eye, yet the algorithm is very simple.

The only problem is that the user can open the database objects. I have not figured that out as of yet.

Same in my case. Opening the VBA window, Immediate window, the user would have full power to manipulate class objects including setting themselves of having different permissions to the application than they should, change their userID to another valid ID, etc...

This IS Access after all, not Kansas, Toto! :cool:
 

Micromax

Registered User.
Local time
Yesterday, 21:32
Joined
Mar 3, 2012
Messages
35
Hi Michael,
That sounds pretty good where you use an algorithm. I wouldn't know how to do that?

Goo luck to you.

Rob
 
Last edited:

mdlueck

Sr. Application Developer
Local time
Yesterday, 21:32
Joined
Jun 23, 2011
Messages
2,631
Hi Michael,
I wouldn't know how to do that?

It is more simple than it sounds. Simply run through a string character by character and swap out some "coded" character(s) for the original character. To convert back, reverse the process.
 

Micromax

Registered User.
Local time
Yesterday, 21:32
Joined
Mar 3, 2012
Messages
35
Hey Michael,

Thanks for sharing that. It sounds like vb, and I'm not that bright at just figuring it out. Not to worry. I think you may have helped more people than just myself.

Thanks again,

Rob
 

k31453

Registered User.
Local time
Yesterday, 18:32
Joined
Jun 4, 2012
Messages
24
Sure:
1) Create a form which gathers login credentials
2) Create a Macro named autoexec which opens said form
3) Exit / Reopen the database to test the results

What is macro properties what do u have to do ??/
 

mdlueck

Sr. Application Developer
Local time
Yesterday, 21:32
Joined
Jun 23, 2011
Messages
2,631
What is macro properties what do u have to do ??/

Just a one-liner that opens the main form. That is my FULL extent of macro programming! :D (A while ago, in this one database: 47,000 LOCs in 156 Modules, and counting... :cool:)
 

Micromax

Registered User.
Local time
Yesterday, 21:32
Joined
Mar 3, 2012
Messages
35
In response to K3.... re the autoexec macro. Wouldn't you still see the database objects when the form is open by executing the macro?

Just wondering,

Thanks,

Rob:)
 

mdlueck

Sr. Application Developer
Local time
Yesterday, 21:32
Joined
Jun 23, 2011
Messages
2,631

Micromax

Registered User.
Local time
Yesterday, 21:32
Joined
Mar 3, 2012
Messages
35
Thanks Michael for the code. you said it was A 2007, and I have A 2003. Not sure if it work there and which event? You have been very helpful so far. I think this may have been part of the macro.

Thanks,

Rob
 

mdlueck

Sr. Application Developer
Local time
Yesterday, 21:32
Joined
Jun 23, 2011
Messages
2,631
I have that code called from the Form_Load event.

No idea about A2003 as I never got so fancy prior to A2007.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:32
Joined
Aug 30, 2003
Messages
36,127
Please do not hijack threads. Though sounding similar, your issue is separate from what this thread was discussing.

In Joe's defense, he is the OP. ;)
 

Users who are viewing this thread

Top Bottom