Solved

How block entry to form if password field is blank

Posted on 2014-04-09
2
294 Views
Last Modified: 2014-04-09
I have this code in an onclick event of a command button on a form but it allows the user to just proceed with nothing in the password field.

What is wrong with this?

If Me.txtPassword <> DLookup("[MaintPassword]", "tblSetup") Or Me.txtPassword = "" Then
        MsgBox "You do not have permission to use any of the database maintenance functions."

--Steve
0
Comment
Question by:SteveL13
2 Comments
 
LVL 7

Accepted Solution

by:
COACHMAN99 earned 500 total points
ID: 39989382
try
If NZ(Me.txtPassword,"")  <> DLookup("[MaintPassword]", "tblSetup")   Or Me.txtPassword ="" then
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39989412
If  Nz(DLookup("MaintPassword", "tblSetup", "MaintPassword ='" & Me.txtPassword & "'"),"")="" Or Me.txtPassword = "" Then

MsgBox "You do not have permission to use any of the database maintenance functions."

exit sub
else


end if

Open in new window



or
If Me.txtPassword & "" = "" Then
    Exit Sub
end if

If  Nz(DLookup("MaintPassword", "tblSetup", "MaintPassword ='" & Me.txtPassword & "'"),"")=""  Then

MsgBox "You do not have permission to use any of the database maintenance functions."

exit sub
else


end if

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now