473,516 Members | 2,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA procedure checks values in login form and compares with entries in database table

4 New Member
Could someone help me, please. I have a login form in Ms Access with two fields "User name" and "Password" and Command button. If I write incorrect password or user name and click on the command button it also access. Command Button has a procedure (on click):
Private Sub Command4_Click()
If IsNull(Me.User_name) Or Me.User_name = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.User_name.SetFocus
Exit Sub
End If

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

If Me.User_password.Value = (DLookup("[Password]", "Passwords", "[Username_ID]=" _
& Me.User_name.Value)) Then

DoCmd.Close acForm, "Login_form", acSaveNo
DoCmd.OpenForm "New_form"

Else..........................

please could someone write what comes next after Else. I think there should be MsgBox that password is incorrect.
Nov 15 '06 #1
1 2437
MMcCarthy
14,534 Recognized Expert Moderator MVP
Welcome to thescripts.

You will need to post this question in the Access forum.

http://www.thescripts.com/forum/forum142.html



Could someone help me, please. I have a login form in Ms Access with two fields "User name" and "Password" and Command button. If I write incorrect password or user name and click on the command button it also access. Command Button has a procedure (on click):
Private Sub Command4_Click()
If IsNull(Me.User_name) Or Me.User_name = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.User_name.SetFocus
Exit Sub
End If

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

If Me.User_password.Value = (DLookup("[Password]", "Passwords", "[Username_ID]=" _
& Me.User_name.Value)) Then

DoCmd.Close acForm, "Login_form", acSaveNo
DoCmd.OpenForm "New_form"

Else..........................

please could someone write what comes next after Else. I think there should be MsgBox that password is incorrect.
Nov 15 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
9313
by: aaapaul | last post by:
Hallo ! I have a Table with a column "ordernumber" ordernumber A12 A45 A77 A88
6
2790
by: fumanchu | last post by:
I've got to let end users (really just one person) load billing batch files into a third party app table. They need to specify the billing cycle name, the batch name, and the input file name and then I can use these values to execute a SQL Server stored procedure to load them into the batch table from the input file (the stored procedure uses...
22
4250
by: M K | last post by:
Heres my SP: ( i am trying to add more than 1 field but get the same error no matter how many i try to add, i thought i would try to insert the primary key only and work up from there but the primary key insert didnt work either. I can run the SP manually in Visual Studio .NET and it works. When i try to do this it doesn't. Any help is...
18
3365
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site relies on subscrption fees. Sessions ID's are matched between the browser and the server. So a users can login with same username and password...
2
22561
by: masri999 | last post by:
I have a requirement in SQL 2005 in Development database 1. Schema dbo owns all objects (tables,views,SPs,UDFs etc) . 2. Only DBA's ( who are database owners ) can create, alter tables . Developer's should not create or alter tables . 3. Developers can create/alter Stored Procedure/User Defined functions in dbo schema and can execute...
5
5724
by: olaamussah | last post by:
Hi, i just started learning perl which i would use for my uni. project unfortunately. Well, this is a simple user login page i tried to create but i cant get it to work. Can someone please check this out. Corrections would be highly appreciated. The code: use strict; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser...
9
3568
by: Ben | last post by:
Hello, I'll bet this has been asked a million times but I can't seem to find a thread that gives the clear example I need. This PC has MySQL and IIS configured and running. The MySQL database is "myDB" with a table "myUsers" with fields "Username" and "Password". I also have the MySQL ODBC driver loaded with a DSN "dsnMySQL" setup. ...
11
4058
by: raylopez99 | last post by:
Keep in mind this is my first compiled SQL program Stored Procedure (SP), copied from a book by Frasier Visual C++.NET in Visual Studio 2005 (Chap12). So far, so theory, except for one bug (feature?) below. At some point I'm sure I'll be able to laugh about this, akin to forgeting a semi-colon in C/C++, but right now it's frustrating (time...
2
2807
by: priyamtheone | last post by:
I'm trying to create a stored procedure in MSSQL Server 2005 that'll perform the following jobs: 1) Create a login. 2) Create an user in TestDB database for the login created in step 1. 3) Assign the role 'db_generaluser' to the user created in step 2. The login name and password for the login to be created will be supplied from externally...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7408
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7581
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.