Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

testing a field for case

Status
Not open for further replies.

assets

Technical User
Oct 23, 2002
574
AU
I have a password form. On that form I test the on change properties and if the caps lock is on it shows a label saying caps lock is on. This works fine. BUT what I would love to do is when the form does the dlookup to see if the text entered matches the field test for case. At this stage as normal it does not matter if it is upper or lower case just that the letter are correct, with the dlookup.

Any suggestions would be appreciated.

Never give up never give in.

There are no short cuts to anything worth doing :)
 
convert your password to "LCase" before you pass to DLookUp.
[tt]
=DLookUp("......","......" "...=LCase(txtPassword))[/tt]

________________________________________________________
Zameer Abdulla
Help to find Missing people
All cats love fish but fear to wet their paws..
 
Hi assets,

On the password form...
Change you VBA code from

Option Explicit

To

Option Compare

Now the user must enter the password exactly as it was stored to return true! Basically... It's Case Sensitive!!!

Hope this is what you were looking for!

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Sorry,

I forgot to type the example...

If your password was Magic (capital M) and you try to login with magic (lower case m) they are not the same!

Where Option Explicit will return them as the same, simply change the Option statement, and you'll save yourself a ton of coding!

I actually wrote a function, that checked each character at a time for case sensitivity until I stumbled upon the Option Compare.... Works much quicker...

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Then there is StrComp:
StrComp("m", "M", vbBinaryCompare)
 
Don't remove Option Explicit! That's something rather different;-)

To change comparision method for one module alter the

[tt]Option Compare Database[/tt]

to

[tt]Option Compare Binary[/tt]

(or just remove the

[tt]Option Compare <option>[/tt]

statement.

I think I'd go with Remou's suggestion.

Roy-Vidar
 

Yes, I agree the strComp is much easier.

But then you need to test each character in the string.
This is what my function did.

Get the length of the string, then loop it comparing each letter. If each loop matched, then I proceeded to load the next form. Or displayed a message that it was an invalid login.

I've been using Option Compare Binary ever since I found out about it, and have had no problems at all.

Of course, this is only on the login form where I use the Option Compare Binary. Which I replace the Option Explicit after development is done.

Which ever seems to help, good luck assets...



AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
> Yes, I agree the strComp is much easier.

> But then you need to test each character in the string.

Are you sure? Have you tried something like

[tt]? StrComp("MyString", "mystring", vbBinaryCompare)
vs
? StrComp("mystring", "mystring", vbBinaryCompare)[/tt]

Roy-Vidar
 
Sorry for not responding I did not get notification of your responses only with this thread, for some reason (I s started in at home and not work). As always all input is GREATLY appreciated. It a good to have different ideas. I will thry this after the christmas/new year period on my return to work. All the best and have a good time with famly and friends.

Never give up never give in.

There are no short cuts to anything worth doing :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top