R Reppihsrow New member Local time Today, 22:40 Joined Jun 13, 2011 Messages 11 Jun 29, 2011 #1 How can I make a query that is case sensitive? thanks in advanced for your help.
John Big Booty AWF VIP Local time Tomorrow, 01:40 Joined Aug 29, 2005 Messages 8,243 Jun 29, 2011 #2 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
R Reppihsrow New member Local time Today, 22:40 Joined Jun 13, 2011 Messages 11 Jul 7, 2011 #3 John Big Booty said: 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 Click to expand... - But where I will put that in a simple query?
John Big Booty said: 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 Click to expand... - But where I will put that in a simple query?
G Galaxiom Super Moderator Staff member Local time Tomorrow, 01:40 Joined Jan 20, 2009 Messages 12,832 Jul 7, 2011 #4 John Big Booty said: 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 Click to expand... 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
John Big Booty said: 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 Click to expand... 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