473,770 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making simple login window 'dynamic'

5 New Member
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 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)
Sep 13 '08 #2
davidogutu
5 New Member
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
2768
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....
2
5324
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,...
4
2274
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...
27
4621
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 ) {
2
1304
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...
1
16513
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
0
938
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 { int login(string db, string login, string password);
1
1582
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
1
1845
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 --> <!-- /*...
0
9432
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,...
0
10232
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
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,...
0
9873
tracyyun
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...
0
8891
agi2029
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...
1
7420
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 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...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2822
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.