Results 1 to 2 of 2

Thread: [RESOLVED] Query problem

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [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) & "'")

  2. #2
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    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) & "' "
    Last edited by leinad31; Jun 14th, 2007 at 04:27 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width