Hello there, I am doing a school project and we haven't been taught lots of VBA.
To earn more marks, I copied this example (it's allowed-research) from databasedev.co. uk and I want to make the 'admin' to see a different form from the 'limited user'
You can download it from http://databasedev.co.uk/downloads/login.zip
I would appreciate the help.
Thanks in advance.
Here is the VBA code: - Private Sub cmdLogin_Click()
-
-
'Check to see if data is entered into the UserName combo box
-
-
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
-
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
-
Me.cboEmployee.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 tblEmployees to see if this matches value chosen in combo box
-
-
If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", "[EmpID]=" & Me.cboEmployee.Value) Then
-
-
lngMyEmpID = Me.cboEmployee.Value
-
-
'Close logon form and open splash screen
-
-
DoCmd.Close acForm, "frmLoginForm", acSaveNo
-
DoCmd.OpenForm "frmSelectLevelSwitch"
-
-
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 your system administrator.", vbCritical, "Restricted Access!"
-
Application.Quit
-
End If
-
-
End Sub
2 1691 nico5038 3,080
Recognized Expert Specialist
We don't do school projects, but I can give directions.
You'll need to add a test for "admin" in the code before opening a different form.
For getting the "admin marker" from the usertable you can use a DLookup like:
DLookup("IsAdmi n", "tblEmploye es", "[EmpID]=" & Me.cboEmployee. Value)
Success !
Nic;o)
Thanks Nico. I'll give it a try
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: |-|erc |
last post by:
Hi!
Small challenge for you.
The index.php uses this file and calls layout(). Take a look at www.chatty.net this file
draws the chat login box on the right. I traced the CHAT button it submits and
goes to the index file again, I can't figure out how it opens the chatroom. I want
to get it to skip the login box and go straight to the room, with user name "guest"
or "" or whatever but I'll add a field to type the name in the chat room....
|
by: Angie |
last post by:
Hello everybody,
I have an osCommerce shopping cart on my site, which is an open-source
product that uses php. I'm very new to php. I also have an online
scheduling application that I outsourced to a third party, which
resides on a different server. I asked my scheduling provider if there
was anyway I could use my osCommerce php registration for thier
registration so I could avoid having visitors to the site register and
sign-in twice,...
|
by: Alfred Salton |
last post by:
I have a dynamic form that is managed entirely on the browser side
(that is fields are added and removed without a postback). The page the
form is on requires a login.
When the user submits the form, the session login may have been lost
due to a timeout - can anyone suggest a mechanism for retaining the
form data and automatically posting after redirection from the login
page? Storing the data in a cookie isn't practical (too many...
|
by: one man army |
last post by:
Hi All-
I am new to PHP. I found FAQTS and the php manual. I am trying this
sequence, but getting 'no zip string found:'... PHP Version 4.4.0
$doc = new DomDocument;
$res = $doc->loadHTMLFile("./aBasicSearchResult.html");
if ( $res == true )
{
$zip = $doc->getElementById('zipRaw_id')->value;
if ( 0 != $zip ) {
|
by: bpnet |
last post by:
Hi am wondering if u can give me a little help with some code. Im a little new to JS so please bare with me :)
Im creating a login code for our clients to visit a section on our website that is personnal to them. I wanted to stay away from the php side for this website.
The section does not need to be very secure, but the code i have at the moment allows the users to log in but it does not open a new browser window, it opens the page in...
| |
by: www.web20developers.com |
last post by:
http://www.web20developers.com
http://www.web20developers.com/index.php?option=com_content&task=view...
Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell
AJAX - microlink pattern tutorial : A microlink is a link that opens up
|
by: shahjapan |
last post by:
Hello,
for the web services I have made a interface like this,
But how to make this http://192.168.0.6:8069/ dynamic anyone knows ???
public interface Ilogin
{
int login(string db, string login, string password);
|
by: DougJrs |
last post by:
Good Morning,
I am trying to write a simple function that would grab the "errorId"
parameter and then display a message when the page loads. I basically
have a login page (login.asp) that if the login fails the user is
directed page to the login page with an errorId parameter (login.asp?
errorId=1).
I wrote the javascript below to grab the paramater and then retuen a
message (I borrowed the gup function from an example, and wrote the
|
by: HACKhalo2 |
last post by:
Hi. I'm helping a friend of mine develop an online game, which is currently outdated. The person making skins for the site came up with a cool looking NavBar (found at http://www.thejackofclubs.net/images/soc_concept4.png ) and I want to change the current navbar (which is right now generated via PHP using tables and outdated expressions). The code is
<script language="javascript" type="text/javascript"> <!-- Modified menu code -->
<!--
/*...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |