Solved

How block entry to form if password field is blank

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

Expert Comment

by:Rey Obrero (Capricorn1)
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

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…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

776 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