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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignoring Case in VBA

Status
Not open for further replies.

DirtyB

Programmer
Mar 13, 2001
159
US
I am matching two fields that have the same string, only the cases are very different. For example, I need "IlInOiS" to match to "Illinois" and "ILLINOIS". I know of the ucase() and lcase(), but is there a function that would allow me to ignore case altogether, or some kind of anycase() function?


Thanks
 
DirtyB,

Lookup the "StrComp()" function...

 
Thanks for the reply. I apologize but I probably should have mentioned this. Here's what's going on: I am trying to standardize a database that is several years old. In the [City] field, we have data like, "Denv", "DENVER", "Den", "DEnv", and every other misspelling possible. I have been using the instr() function to say "if DEN appears in [City] then set city = 'Denver'". This works, but with instr, it is case sensitive, so if I am looking for "DEN", the "denvers" don't get set to a standard value. If I use strcomp then the misspellings and variations don't get caught. I hope this clarifies my situation, thanks for helping.
 
OK,

Well couldn't you use the InStr() and LCase() or UCase()together?

Like this: InStr(UCase("DEnv"), "DEN")

This should make the first string completely caps for the purpose of comparison and give you your answer...

Hope this helps...

Kyle ::)


Although as a side note, on my PC, (Access '97) InStr() isn't case sensitive...



 
That's what I need to do, thanks so much. I didn't think that the instr was case sensitive either, but it was giving me zeros saying that "DEN" wasn't in "denver". Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top