Match case on password confirmation

B

BruceM

I have implemented user-level security, and have added a form that opens
automatically if the user's password is "". The form requires that a
password be entered. The form can also be opened manually if the user
wishes to change the password. There is a Password text box and a Confirm
Password text box. Both have to match before the password will be accepted.
The trouble is that "Password" and "password" are the same as far as any
validation I have been able to contrive. Is there a relatively simple way
of managing the situation? The best I have been able to imagine so far is
to use code to see if the two are equivalent (which they would be since the
VBA comparison is not case-sensitive). If they are equivalent, loop through
the characters in the password and get the Asc value for each character,
then add those values for each text box. With the words above, the combined
values would differ from each other by 32 because of the uppercase and
lowercase letter to start the word.
This seems quite roundabout, but it's all I can think of. If there is an
easier way, I would like to learn about it. If my general idea is as good
as anything, I could use some help implementing it. I think I would need to
find the length of the string, then loop through the code, adding one to an
integer each time through until the integer equals the length, but even if I
could sort out how to do that I'm not sure I could figure out how to extract
the Asc value as I go.
 
G

Guest

Bruce,

Try something like this:

if strComp(password, userpassword, vbBinaryCompare)<>0 then
...... your code here.
end if

where password is the password which the usere entered and userpassword is
the password to compare it with.

Maurice
 
B

BruceM

Thanks! That was exactly what I needed, but I didn't know about the strComp
function (or maybe I once knew, then I forgot). Either way, problem solved.
 

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

Similar Threads


Top