473,473 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need help with password form

72 New Member
Hey Everybody,
I have a form with a label ("Enter Password"), a textbox (with a password InputMask), and two command buttons ("OK" and "Cancel"). I've successfully written code for the "OK" command button to check the password in the textbox with an OnClick event. It then either opens the authorized form or it doesn't.

However, I would also like to set an event for the textbox, so when the user hits the Enter key, the same code is executed as for the "OK" button's OnClick event. I tried running the code below, but I kept getting a response stating, "This action can't be carried out while processing a form or report event."

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtEnterPassword_Exit(Cancel As Integer)
  2. On Error GoTo Err_txtEnterPassword_Exit
  3.  
  4.     Dim stDocName As String, stLinkCriteria As String
  5.  
  6.     If Me.txtEnterPassword = "proc_eng" Then
  7.         ' Password is correct; open form below and exit Main Menu.
  8.         stDocName = "Add Column"
  9.         DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.         DoCmd.Close acForm, "Main Menu"
  11.         DoCmd.Close acForm, "Authorization Required"
  12.     Else
  13.         MsgBox "Incorrect Password", vbOKOnly, "Access Denied"
  14.         ' Password is incorrect.
  15.     End If
  16.  
  17. Exit_txtEnterPassword_Exit:
  18.     Exit Sub
  19.  
  20. Err_txtEnterPassword_Exit:
  21.     MsgBox Err.Description
  22.     Resume Exit_txtEnterPassword_Exit
  23. End Sub
I found that the DoCmd.Close acForm, "Authorization Required" line of code was the problem. If I delete it, the rest of the code works. However, I need that form to close. What did I do wrong? How do I fix it? Please post the exact changes that need to be made.

Thanks!
Jun 6 '07 #1
4 1573
mforema
72 New Member
Hey Everybody,
I have a form with a label ("Enter Password"), a textbox (with a password InputMask), and two command buttons ("OK" and "Cancel"). I've successfully written code for the "OK" command button to check the password in the textbox with an OnClick event. It then either opens the authorized form or it doesn't.

However, I would also like to set an event for the textbox, so when the user hits the Enter key, the same code is executed as for the "OK" button's OnClick event. I tried running the code below, but I kept getting a response stating, "This action can't be carried out while processing a form or report event."

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtEnterPassword_Exit(Cancel As Integer)
  2. On Error GoTo Err_txtEnterPassword_Exit
  3.  
  4.     Dim stDocName As String, stLinkCriteria As String
  5.  
  6.     If Me.txtEnterPassword = "proc_eng" Then
  7.         ' Password is correct; open form below and exit Main Menu.
  8.         stDocName = "Add Column"
  9.         DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.         DoCmd.Close acForm, "Main Menu"
  11.         DoCmd.Close acForm, "Authorization Required"
  12.     Else
  13.         MsgBox "Incorrect Password", vbOKOnly, "Access Denied"
  14.         ' Password is incorrect.
  15.     End If
  16.  
  17. Exit_txtEnterPassword_Exit:
  18.     Exit Sub
  19.  
  20. Err_txtEnterPassword_Exit:
  21.     MsgBox Err.Description
  22.     Resume Exit_txtEnterPassword_Exit
  23. End Sub
I found that the DoCmd.Close acForm, "Authorization Required" line of code was the problem. If I delete it, the rest of the code works. However, I need that form to close. What did I do wrong? How do I fix it? Please post the exact changes that need to be made.

Thanks!

Can someone help me?
Jun 7 '07 #2
MMcCarthy
14,534 Recognized Expert Moderator MVP
Try putting your code in the After Update event of the textbox
Jun 13 '07 #3
hyperpau
184 Recognized Expert New Member
Can someone help me?
Put an after_update event on the txtbox
that would set focus on the OK key.

So as soon as user inputs text, focus goes to OK key and
the moment they press enter, the ok key function is called
Jun 13 '07 #4
wassimdaccache
222 New Member
I had the same problem once and I changed the order and it works

try to do that ...
DoCmd.Close acForm, "Authorization Required"
DoCmd.Close acForm, "Main Menu"
DoCmd.OpenForm stDocName, , , stLinkCriteria


I'm not an expert member but I think it will works ..please try it and tell me if it works

thank you
Jun 25 '07 #5

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

Similar topics

2
by: Bobby | last post by:
Hello everyone I have a question. The school I am working for is in the beginning process of having a webpage that will direct students to download there homework and be able to view there info...
15
by: carr4895 | last post by:
Hello. I was wondering if someone could help me too with a login form. Upon startup, I have to display a password screen and it should accept a user name and password. User name can be anything...
28
by: Gaby | last post by:
Hi guys, I have this ASP code that is a little long to post so but you can download it off of http://whatthedeuce.net/Form.asp I cant find out what my error is. I know it is not in my Access...
2
by: wipit | last post by:
I need to process a HTML form in python. I'm using urllib2 and HTMLParser to handle the html. There are several steps I need to take to get to the specific page on the relevant site the first of...
0
by: Vash10 | last post by:
I have two asp files. Login.asp and changePass.asp. what i want to do is to make the user change his password after his first login. so what happens is login.asp is the first to be used then it is...
2
by: mabzkie | last post by:
whats wrong with my codes? i need to login using two textfields: txtuser for the username and txtpass for the password. i am using ado and ms access as a database. when i tried to enter with a long...
5
eragon
by: eragon | last post by:
I am making a password script, i have most of it done, ill show you, but i hit a brick wall.... lol, I have it so when you log in it takes you to your main page, that works, but when you enter the...
2
by: chaos | last post by:
Hi all, i need help in this forgot password page, as the error message is show in another page cause the arrangement of the design in a mess. As i want to show the error message on the forgot...
2
bmallett
by: bmallett | last post by:
I am getting the following error: Error Type: ADODB.Command (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another....
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
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...
1
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
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
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...

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.