-
[RESOLVED] Query problem
i use dbf file.
When I query by insert the text in the text2 box, "DDDD" or "dddd" or "Dddd" it work because the data in the field name is "Dddd".
But When I change the data in the dbf data in the table to be like this "DDDD" or "dddd". and query again by insert the text in the text2 box, "DDDD" or "dddd" or "Dddd" . It doesn't work.
I would like the query success without ignoring its uppercase, lowercase of the data in the database.
Why I change the data in the database from "Dddd" to "DDDD" or "dddd" it doesn't work.
Code:
SearchExpression("Owner1 = '" & StrConv(Text2.Text, vbProperCase) & "' or Owner2= '" & StrConv(Text2.Text, vbProperCase) & "'")
-
Re: Query problem
Your converting textbox inputs to propercase... so it always becomes Dddd regardless of the case in the textbox... and when binary comparison is performed with an equal sign then it will only become equal when the data in the database is also in propercase format (in addition to being same letters).
Your debugging based on what you see in the screen (like a user) when the source code uses StrConv() function on the textbox. Something to remember in the future.
If you want comparison to be case insensitive then make sure the input and the data in the database are in the same case.
"SELECT...FROM...WHERE UCASE(fieldname) = '" & UCASE(txtbox.text) & "' "