Password Protect Button From Combo Box List

D

DaveAP

Access 2003, Windows XP

I am trying to password protect button which opens a form for multiple
users. The additional problem is the button has two combo boxes from which
the user selects their name and which form they wish to use.

The forms they are opening are according to a query so only their records
they need to work are made available.

I have a table for the form names and a table of the users.

I'm have very little experience coding unfortunately, and this would help
protect the different work queues of the users. Thanks!
 
D

DaveAP

Thank you for the tip, but I'm looking for a way to password protect the form
so when a particular rep (Jan) has to enter her specific password (Vikings)
to have her queue open after clicking on the button.

I added a text box for the password and made a "password" column in the Rep
Names table. This seems to work, but how do I differenciate between a blank
query and the wrong password being used?

Again I apologize if I'm not phrasing the questions right.
 
K

Klatuu

How strange. It looks like my answer had nothing to do with your post.

I would not use a combo for the user to enter their name. You can download
this api:

http://www.mvps.org/access/api/api0008.htm

You can use it to return the login name of the person logged in to your
network.

Then when the user enters their password, use a DLookup to return the
password field and compare it to what was entered:

Private Function txtPwd_BeforeUpdate(Cancel As Integer)

If DLookup("PassWordField","UserTable","[UserID] = """ & _
GetUserID & """") <> Me.txtPwd Then
MsgBox "Password Is InCorrect"
Cancel = True
End If
End Sub

Private Function txtPwd_AfterUpdate()
Docmd.OpenForm ....
End Sub
 
D

DaveAP

Perfect, thanks!!

Klatuu said:
How strange. It looks like my answer had nothing to do with your post.

I would not use a combo for the user to enter their name. You can download
this api:

http://www.mvps.org/access/api/api0008.htm

You can use it to return the login name of the person logged in to your
network.

Then when the user enters their password, use a DLookup to return the
password field and compare it to what was entered:

Private Function txtPwd_BeforeUpdate(Cancel As Integer)

If DLookup("PassWordField","UserTable","[UserID] = """ & _
GetUserID & """") <> Me.txtPwd Then
MsgBox "Password Is InCorrect"
Cancel = True
End If
End Sub

Private Function txtPwd_AfterUpdate()
Docmd.OpenForm ....
End Sub
--
Dave Hargis, Microsoft Access MVP


DaveAP said:
Thank you for the tip, but I'm looking for a way to password protect the form
so when a particular rep (Jan) has to enter her specific password (Vikings)
to have her queue open after clicking on the button.

I added a text box for the password and made a "password" column in the Rep
Names table. This seems to work, but how do I differenciate between a blank
query and the wrong password being used?

Again I apologize if I'm not phrasing the questions right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top