Setting A Password Rule For A Field

  • Thread starter Thread starter Chipcom
  • Start date Start date
C

Chipcom

Hi

I need to know how to set a rule to a password field that the user
only be able to type english letters and numbers .

Any idea how?


Thanks
 
I got this from a previous post from HTH

Try this code in the BeforeUpdate event of the checkbox:

(untested)

if inputbox ("enter password") <> "s3cr3t" then
me.undo
cancel = true
endif

If you get tired of repeatedly entering the password, try this:

static bOK as boolean
if not bOK then
if inputbox ("enter password") = "s3cr3t" then
bOK = true
else
me.undo
cancel = true
endif


Good Luck
 
Paste the following code into the KeyPress event of your text box so
that it looks like this :-

Private Sub YourFieldName_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) Like "[!0-9A-Z]" And _
KeyAscii <> vbKeyBack Then KeyAscii = 0
End Sub

Change the word YourFieldName for the name of your text field.

This allows the user to press keys 0 to 9 and A to Z and the BackSpace
key only.

HTH

Peter Hibbs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top