Connecting Tech Pros Worldwide Forums | Help | Site Map

Input Mask and Simple Login Form

Newbie
 
Join Date: Dec 2007
Posts: 15
#1: Dec 28 '07
Is there a way to add an input mask in an input box?

missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 3,000
#2: Dec 28 '07

re: Input Mask and Simple Login Form


Afraid not! What you can do is create a small popup form that emulates an Input Box. Then you can do all the things any form can do.

Welcome to TheScripts!

Linq ;0)>
Newbie
 
Join Date: Dec 2007
Posts: 15
#3: Dec 28 '07

re: Input Mask and Simple Login Form


Quote:

Originally Posted by missinglinq

Afraid not! What you can do is create a small popup form that emulates an Input Box. Then you can do all the things any form can do.

Welcome to TheScripts!

Linq ;0)>



That's what I figured, now comes the next question... I have created a popup form (with the text field input mask set to password) and I have two command buttons on it. One cancels and closes the form and I want the other one to verify that the password is correct, opening the administrator form. I know I need to write the code but can't figure it out. Any ideas? I'm sure it's simple, I'm just new. Thanks!
Minion's Avatar
Expert
 
Join Date: Dec 2007
Posts: 98
#4: Dec 28 '07

re: Input Mask and Simple Login Form


Quote:

Originally Posted by vstolmech513

That's what I figured, now comes the next question... I have created a popup form (with the text field input mask set to password) and I have two command buttons on it. One cancels and closes the form and I want the other one to verify that the password is correct, opening the administrator form. I know I need to write the code but can't figure it out. Any ideas? I'm sure it's simple, I'm just new. Thanks!

There are several ways to go about this and I'm sure you'll get a couple example in the following posts. However, first we need to know a few things.
1. Is the password stored as variable or in a table?
2. Is the password associated with a particular user?
3. Are you planning on using any more encryption beyond the input mask?
4. Do you want to limit the number of attempts?
Of course there are more, but this should allow for a basic example to be drawn up. I think I have some existing code in a project that will work for this (it's a admin panel of my own) that I will share as soon as I know the parameters of the question.

Keep us up to date.

- Minion -
Newbie
 
Join Date: Dec 2007
Posts: 15
#5: Dec 30 '07

re: Input Mask and Simple Login Form


The password is stored in a table and not associated with a certain user. It's just a simple password that will allow me to access the form in order to edit the records. The input mask is just so no one can see what's entered and there is no need to limit the number of attempts. All I'd like is that when the password is entered correctly the command button, when clicked, will verify the password and if it's correct open the form. It sounds simple but I'm clueless when it comes to writing code... i.e. it's not in the VBA for Dummies book! Thanks for any help you can offer.
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 3,000
#6: Dec 30 '07

re: Input Mask and Simple Login Form


Assuming:

2 buttons, CancelButton and SubmitButton

1 textbox, PasswordTextBox

1 table, PasswordTable

1 field in PasswordTable named AdminPassword (text datatype)

1 form, AdminForm

On your login form:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CancelButton_Click()
  2.   DoCmd.Close
  3. End Sub
  4.  
  5. Private Sub SubmitButton_Click()
  6.  
  7. If DLookup("AdminPassword", "PasswordTable") = Me.PasswordTextBox Then
  8.   DoCmd.Close
  9.   DoCmd.OpenForm "AdminForm"
  10. Else
  11.   MsgBox "Incorrect Password! Try again!"
  12.   PasswordTextBox.SetFocus
  13.   Me.PasswordTextBox = ""
  14. End If
  15.  
  16. End Sub
Linq ;0)>
Newbie
 
Join Date: Dec 2007
Posts: 15
#7: Dec 31 '07

re: Input Mask and Simple Login Form


Worked great! Thanks again for all the help. I'm sure it was rather obvious, but a huge help to a beginner!
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 3,000
#8: Jan 1 '08

re: Input Mask and Simple Login Form


Glad we could help!

Linq ;0)>
Reply


Similar Microsoft Access / VBA bytes