Fields empty on logon form.

Danden

Registered User.
Local time
Yesterday, 18:47
Joined
Jun 10, 2013
Messages
26
I have a logon form that always contains a value in the user name and password fields. How can I do it that these two fields are empty when the logon form is displayed? When I put this code in a program text12.value="" then it delete user name in database.
 
your username and password fields should be unbound (no controlsource).

Depending on how your logon form is intended to work, it is usual to have the form unbound as well.

Then once the user has entered a name and password use dlookup or currentdb.openrecordset to verify the name and password are valid and to load any access rights assigned to the user.

Note. Since this is somewhere where the user is inputting text (as opposed to selecting from a list, clicking an option etc) it is a good idea to use the replace function to remove any single quotation marks which the user may have input - they can cause an error in the query operation and in the wrong hands can be used for what is called SQL injection to damage your db
 
Thanks for your help, the problem was that the username and password should be unbound. But when I open my database I get logon form to appears automatically, but I see that it is also possible to open other forms, regardless of the logon. Is there a way to protect other forms, when the person is not logged into the system.
 
I would suggest that the logon form is set to modal and popup. In this way, the user cannot access other forms until they have logged in. Note, ensure you disable the control box on the form and provide a button for the user to click to close and exit the db

If this leaves a form visible with sensitive data then the other thing to do is to either hide or close open forms - you need to run a routine in the logon form open event - you'll find plenty of posts on how to do this on this forum.
 

Users who are viewing this thread

Back
Top Bottom