Solved

How block entry to form if password field is blank

Posted on 2014-04-09
2
295 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

863 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

26 Experts available now in Live!

Get 1:1 Help Now