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

Password Login and continue opening form

105 100+
Hi everyone!

I have a form that has two command buttons (Add, and Edit). If the user clicks Add, another form pops up asking for a username and password. If the user enters the username and password corrrectly, the login form closes, but nothing else happens. I want the frmAddMenWorshipform to come up now but I don't know what to do?

Thanks!

-Joseph
Mar 23 '08 #1
5 1644
jmarcrum
105 100+
And the problem is...I want to use this login form multiple times, so I can't put code in there to just open one specific frmAddMenWorship form. I have another form frmAddMenReading and frmAddMenSinging...etc...as well.
Mar 23 '08 #2
jmarcrum
105 100+
Here's my code...

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdAddMenWorship_Click()
  2.  
  3. 'Open frmAddMenWorship to view
  4. DoCmd.OpenForm "frmLogin"
  5.  
  6. 'Open frmAddMenWorship
  7. DoCmd.OpenForm "frmAddMenWorship"
  8.  
  9. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdEnter_Click()
  2.  
  3. 'Check to see if data is entered into the UserName combo box
  4. If IsNull(Me.cmbUsername) Or Me.cmbUsername = "" Then
  5.     MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
  6.     Me.cmbUsername.SetFocus
  7.     Exit Sub
  8. End If
  9.  
  10. 'Check to see if data is entered into the password box
  11. If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
  12.     MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
  13.     Me.txtPassword.SetFocus
  14.     Exit Sub
  15. End If
  16.  
  17. 'Check value of password in tblLogin to see if this matches value chosen in combo box
  18.  
  19. If Me.txtPassword.Value = DLookup("Password", "tblLogin", "[UserID]=" & Me.cmbUsername.Value) Then
  20.     UserID = Me.cmbUsername.Value
  21.     DoCmd.Close acForm, "frmLogin", acSaveNo
  22. Else
  23.     intLogonAttempts = intLogonAttempts + 1
  24.     'If User Enters incorrect password 3 times login will close
  25.     If intLogonAttempts > 3 Then
  26.         MsgBox "Password Invalid.  You cannot enter data!", vbCritical, "Restricted Access!"
  27.         DoCmd.Close
  28.     'Warn the user tht they have one more chance
  29.     ElseIf intLogonAttempts = 3 Then
  30.         MsgBox "Password Invalid.  You have one more chance!", vbCritical, "Warning!"
  31.     'Ivalid Password
  32.     Else
  33.         MsgBox "Password Invalid.  Please Try Again", vbOKOnly, "Invalid Entry!"
  34.         Me.txtPassword.SetFocus
  35.     End If
  36. End If
  37.  
  38. End Sub
Mar 23 '08 #3
jmarcrum
105 100+
does anyone know or have an idea how to do this? Maybe Me.OpenArgs?
Mar 23 '08 #4
jmarcrum
105 100+
I figured it out!

Since I have multiple forms that I would like to associate with frmLogin, I created a textbox on frmLogin that had the Visible control = False. When I selected Add on frmAddMenWorship it assigned a numerical value to the textbox and then opened frmLogin. Then, on frmLogin, i wrote a Select Case. If the user enters the correct password associated with the selected username, then I check the textbox's value on frmLogin and open the form, by case number, that matches the numerical value that I assigned to the textbox. Cool huh!

YAY!!
Mar 24 '08 #5
NeoPa
32,556 Expert Mod 16PB
I'm sorry that no-one seemed to find this or offer help Joseph, but you seem to have done a fine job on your own anyway ;)
Mar 25 '08 #6

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

Similar topics

6
by: Lou | last post by:
Please can someone put me out my misery! Im trying to find a multiple user/password protection script that will redirect the specific user to a specific directory. At the moment I have set up...
2
by: RICHARD BROMBERG | last post by:
I am building a password protected ASP web site. (http://www.allscrewedup.org) When you go to this site there is a link in upper left corner (VIP) that takes you to a Logon Screen. The user...
3
by: Whitey | last post by:
I have a password secured database. After the password is entered the user has a form that I created that allows them to search the database and retrieve information. The problem is that the...
3
by: bill | last post by:
I need to open a asp.net web form from a classic asp page, and pass a username and password to the asp.net page. The username and password exist as session variables in the classic asp...
2
by: mankolele | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Simple Database Connection</title> </head> <body bgcolor="white"> <?php $connection =...
3
by: Noel S Pamfree | last post by:
Problem 1 ======= I need to create a page for a friend who operates a school website. She needs to set up a page so that only the Governors can access it. I thought I'd try to use JavaScript to...
1
by: roshina | last post by:
Hi Iam facing a problem in my project, developing a web site for online shopping in ASP on windows XP using IIS server. All the validations are ok but the new password is not upadated in the data...
3
by: MIUSS | last post by:
Hi need an advice, I'm beginner with PHP. I got little problem: I use this solution as login to get administration of my pages: <?php // if authorization isn't done we request it if...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.