Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2006
    Posts
    26

    Question Unanswered: Wild Cards in Parameter

    Hi,

    I have a form in which I have a unbound txt field which passes to the criteria to a list box in the same form by using a
    cmd button
    Onclick.Requery for the list box.

    I have used a sql statement to populate the list box where one of the criteria in the fields looks like:
    [Forms]![Myform]![txtfield]

    All works like a charm but the problem hits the fan when I try to use a wild card on either side of the criteria, it populates quotes on each side and then the query doesn't know where to pick the criteria from.

    Any Ideas guys, I have given everything I had with No luck.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Please can you post your SQL statement for the list box
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2006
    Posts
    26

    Exclamation Sql Statement

    Current which works fine with no wild cards:
    SELECT [SO Cust Master].[cInitials], [SO Cust Master].[houseNumber], [SO Cust Master].[addrLine1], [SO Cust Master].[postCode], [SO Cust Master].[cSurname], [SO Cust Master].[DMBarcode] FROM [SO Cust Master] WHERE ((([SO Cust Master].[cSurname])=[Forms]![FRMCUSTDetailSearch]![TXTSearch]));

    With Wild cards which doesn't work:
    SELECT [SO Cust Master].cInitials, [SO Cust Master].houseNumber, [SO Cust Master].addrLine1, [SO Cust Master].postCode, [SO Cust Master].cSurname, [SO Cust Master].DMBarcode FROM [SO Cust Master] WHERE ((([SO Cust Master].cSurname) Like "*[Forms]![FRMCUSTDetailSearch]![TXTSearch]*"));

    Thanks in advance !

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Two options. Teach your users to input the wildcards themselves (preferable) and then:
    Code:
    SELECT [cInitials], [houseNumber], [addrLine1], 
    [postCode], [cSurname], [DMBarcode] 
    FROM [SO Cust Master] 
    WHERE [cSurname] LIKE [Forms]![FRMCUSTDetailSearch]![TXTSearch]
    Or, if you feel you must pop in the wildcards, then:
    Code:
    SELECT [cInitials], [houseNumber], [addrLine1], 
    [postCode], [cSurname], [DMBarcode] 
    FROM [SO Cust Master] 
    WHERE [cSurname] LIKE "*" & [Forms]![FRMCUSTDetailSearch]![TXTSearch] & "*"
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Feb 2006
    Posts
    26
    Thanks Alot works perfectly!

Posting Permissions

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