Logon Startup Form

  • Thread starter Thread starter JUAN
  • Start date Start date
J

JUAN

Hello,
I would like to create a User Logon start up form.
I created the form base on Employees table, which contains
USER_ID, PASSWORD. In my form, I did a combo drop box to
show the USER_ID name.
I added a text box so that users can type in their
password. So when the user selects his/her User Id from
the drop box and type in their password, I want to have an
OK/CANCEL button. So when they click on OK, it will open
the main form.
How would my event procedure look like?
Any help would be very helpful.
thanks,
juan
 
Lots of different ways to do this. The following is just one quick example.

Create your combobox with two columns, one column containing the user name
and one column containing the password. Set the column width to 0" for the
second column so it does not show. Call the combo NameCombo.

Create your testbox for the password (named txtPassword).

On the OnClick of your button use code similar to the following for testing.

If Me!txtPassword = Me!NameCombo.Column(1) then
MsgBox "Correct"
Else
MsgBox "Incorrect Password"
End if

This uses the column property of a combo box to get the value of the
password and compares it with what was typed in the textbox. Of course you
can then do what ever you want in opening forms.

I hope this helps! If you have additional questions on this topic, please
reply to this posting.

Need quick answers to questions like these? The Microsoft Knowledge Base
provides a wealth of information that you can use to troubleshoot a problem
or answer a question! It's located at
http://support.microsoft.com/support/c.asp?M=F>.

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.

Regards,
Dennis Schmidt
Microsoft Support
 
which access version you are using
if 2000 or later, try below

dim rst as new adodb.recordset
dim sql as string
sql = "Select * from login where user_id = '" &
dropdownbox & "' and password = '" & passwordtextfield
& "'"
rst.open sql,currentproject.connection
if rst.bof = true or rst.eof = true then
msgbox "ID or Password is not correct"
else
docmd.open acform, "formname"
end if

May
MCP in Access and SQL Server
 
First off, just want to say thanks MAY/Dennis.
Sorry I didn't specified the version I was working. MS 97.
Dennis I took your way, since it seemed easy. And Thank
you it works great.

I really appreciate the info/help to both of you.

Once again,
thank you, :)
juan
 
Back
Top