Case Sensitive Query

Reppihsrow

New member
Local time
Today, 22:40
Joined
Jun 13, 2011
Messages
11
How can I make a query that is case sensitive? thanks in advanced for your help. :)
 
You can use;
Code:
CBool(InStrB(Me.TextF1, Me.TextF2))
to compare two string in a case sensitive manner it will return True if the strings match or False if they don't
 
You can use;
Code:
CBool(InStrB(Me.TextF1, Me.TextF2))
to compare two string in a case sensitive manner it will return True if the strings match or False if they don't

- But where I will put that in a simple query?
 
You can use;
Code:
CBool(InStrB(Me.TextF1, Me.TextF2))
to compare two string in a case sensitive manner it will return True if the strings match or False if they don't

Not quite. That expression will return True if TextF2 is found IN TextF1.

A match would be indicated if the length of the string was tested too.

Also John's expression is applied in VBA to controls or fields on the form only. It cannot be used in a query as the database does not understand Me.

If TextF1 and TextF2 are fields in a table or query then you would use this in the query (including the correction to compare the lengths).

Code:
WHERE CBool(InStrB(TextF1, TextF2)) AND (Len(TextF1) = Len(TextF2))

If you need to refer to a control on the form then you can refer to its full reference.

Code:
Forms!formname.controlname
 

Users who are viewing this thread

Back
Top Bottom