473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

problem with my code

listed below is the code i have written that is not working any help would
be great if you can show me where i went wrong as i am new to this side.
thanks in advance.

Private Sub cmdlogin_Click()

'Check to see if data is entered into the UserName combo box

If IsNull(Me.cbousername) Or Me.cbousername = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cbousername.SetFocus
Exit Sub
End If

'Check to see if data is entered into the password box

If IsNull(Me.txtpassword) Or Me.txtpassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtpassword.SetFocus
Exit Sub
End If

'Check value of password in usyspassword to see if this
'matches value chosen in combo box

If Me.txtpassword.Value = DLookup("Password", "usyspassword", "[ID]=" &
Me.cbousername.Value) Then

ID = Me.cbousername.Value

'Close logon form and open splash screen
If Me.cbousername.Value = "admin" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 1"
ElseIf passwd = "b" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 2"
ElseIf passwd = "c" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 3"
Else
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 4"
End If

Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtpassword.SetFocus
End If

'If User Enters incorrect password 3 times database will shutdown

intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.",
vbCritical, "Restricted Access!"
Application.Quit
End If

Exit_cmdlogin_Click:
Exit Sub

End Sub


Nov 12 '05 #1
3 1606
"Not working" is not much for us to go on. Specific questions stand the best
chance of getting useful answers -- the best questions are "precise and
concise".

What do you expect it to do? What is it doing? What is it not doing that you
expect it to do? Are there error messages? If so, what? If so, what line if
you set the option "Break on all errors"?

Just a comment -- you clearly are trying to implement a "Security Lite",
which is usually an exercise in futility. Even Access' own security can be
broken, but self-implemented security is almost always not only breakable
but easy to break. I'd suggest you download the Security FAQ from
http://www.microsoft.com and give it a good read, more than once -- there's
no "filler" in those 39 pages.

Larry Linson
Microsoft Access MVP

"Michael Hanlon" <mh*****@personainternet.com> wrote in message
news:vt************@corp.supernews.com...
listed below is the code i have written that is not working any help would
be great if you can show me where i went wrong as i am new to this side.
thanks in advance.

Private Sub cmdlogin_Click()

'Check to see if data is entered into the UserName combo box

If IsNull(Me.cbousername) Or Me.cbousername = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cbousername.SetFocus
Exit Sub
End If

'Check to see if data is entered into the password box

If IsNull(Me.txtpassword) Or Me.txtpassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtpassword.SetFocus
Exit Sub
End If

'Check value of password in usyspassword to see if this
'matches value chosen in combo box

If Me.txtpassword.Value = DLookup("Password", "usyspassword", "[ID]=" &
Me.cbousername.Value) Then

ID = Me.cbousername.Value

'Close logon form and open splash screen
If Me.cbousername.Value = "admin" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 1"
ElseIf passwd = "b" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 2"
ElseIf passwd = "c" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 3"
Else
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 4"
End If

Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtpassword.SetFocus
End If

'If User Enters incorrect password 3 times database will shutdown

intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.",
vbCritical, "Restricted Access!"
Application.Quit
End If

Exit_cmdlogin_Click:
Exit Sub

End Sub


Nov 12 '05 #2
"Larry Linson" <bo*****@localhost.not> wrote:
I'd suggest you download the Security FAQ from
http://www.microsoft.com and give it a good read, more than once -- there's
no "filler" in those 39 pages.


Larry

Here's my standarb blurb which you are free to copy as you feel with the URLs to save
searching.

After reviewing the following KB articles and searching in the Knowledge Base at
support.microsoft.com you will likely want to ask your question in the
m.p.access.security newsgroup.

ACC: Microsoft Access Security FAQ Available in Download Center
http://support.microsoft.com/support.../q165/0/09.asp
It is suggested you reread this FAQ several times. I must admit I never quite
understood it.

ACC: Overview of How to Secure a Microsoft Access Database (A2.0 to A97)
http://support.microsoft.com/support.../q132/1/43.asp

ACC2000: Overview of How to Secure a Microsoft Access Database
http://support.microsoft.com/support.../Q254/3/72.ASP

ACC2002: Overview of How to Secure a Microsoft Access DB
http://support.microsoft.com/support.../Q289/8/85.ASP

Note however there have been isolated postings indicating security has been cracked.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #3
"U N Me" <un**@together.com> wrote in message
news:FC**********************@Gilgamesh-Frog.org...

From the message header of the quoted message:

Comments: This message probably did not originate from the above address.
It was automatically remailed by one or more anonymous mail
services.
You should NEVER trust ANY address on Usenet ANYWAYS: use PGP !!!
Get information about complaints from the URL below
X-Remailer-Contact: http://80.65.224.85/POL/ In case my abuse address is
unreachable: It is because it has been flooded by <mg*@uiuc.edu>, please
contact <ab***@uiuc.edu>
Mail-To-News-Contact: ab***@dizum.com
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
7
by: Keith Dewell | last post by:
Greetings! My current job has brought me back to working in C++ which I haven't used since school days. The solution to my problem may be trivial but I have struggled with it for the last two...
6
by: harry | last post by:
Hi, I have a program that runs on multiple client pc's. Occasionally one or more of those pc's use VPN to connect to another corporate network. When using VPN they need to set proxy server in...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
9
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
2
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.