473,406 Members | 2,713 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,406 software developers and data experts.

Making simple login window 'dynamic'

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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdLogin_Click()
  2.  
  3. 'Check to see if data is entered into the UserName combo box
  4.  
  5.     If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
  6.             MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
  7.             Me.cboEmployee.SetFocus
  8.         Exit Sub
  9.     End If
  10.  
  11. 'Check to see if data is entered into the password box
  12.  
  13.     If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
  14.             MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
  15.             Me.txtPassword.SetFocus
  16.         Exit Sub
  17.     End If
  18.  
  19. 'Check value of password in tblEmployees to see if this matches value chosen in combo box
  20.  
  21.     If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", "[EmpID]=" & Me.cboEmployee.Value) Then
  22.  
  23.         lngMyEmpID = Me.cboEmployee.Value
  24.  
  25. 'Close logon form and open splash screen
  26.  
  27.         DoCmd.Close acForm, "frmLoginForm", acSaveNo
  28.         DoCmd.OpenForm "frmSelectLevelSwitch"
  29.  
  30.         Else
  31.         MsgBox "Password Invalid.  Please Try Again", vbOKOnly, "Invalid Entry!"
  32.         Me.txtPassword.SetFocus
  33.     End If
  34.  
  35. 'If User Enters incorrect password 3 times database will shutdown
  36.  
  37.     intLogonAttempts = intLogonAttempts + 1
  38.     If intLogonAttempts > 3 Then
  39.         MsgBox "You do not have access to this database.  Please contact your system administrator.", vbCritical, "Restricted Access!"
  40.         Application.Quit
  41.     End If
  42.  
  43. End Sub
Sep 13 '08 #1
2 1679
nico5038
3,080 Expert 2GB
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("IsAdmin", "tblEmployees", "[EmpID]=" & Me.cboEmployee.Value)

Success !

Nic;o)
Sep 13 '08 #2
Thanks Nico. I'll give it a try
Sep 14 '08 #3

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

Similar topics

0
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...
2
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...
4
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...
27
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 =...
2
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...
1
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 -...
0
shahjapan
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 { ...
1
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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...
0
isladogs
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...

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.