Results 1 to 7 of 7

Thread: Query

  1. #1
    Join Date
    Mar 2008
    Posts
    29

    Question Unanswered: Query

    Hi all,
    I had one query with LIKE.

    as

    SELECT C_DATE FROM SYSADM.CASH
    WHERE C_NARR_1 LIKE 'Deposit Slip No.%'|| :colAccNo


    where colAccNo is one parameter.
    I want to run it from frontend.

    Is it correct to concatenation some string with parameter.
    Please

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    A typical Access SQL statement with a concatenation would look like this:

    SELECT C_DATE FROM SYSADM
    WHERE C_NARR_1 LIKE "Deposit Slip No.%" & [colAccNo]
    I removed the .CASH from the select clause because Access doesn't allow dots in a tablename.

    The & symbol is what is used for concatenation.

    I changed :colAccNo to [ColAccNo] as this is the typical way to address a parameter.

    HTH
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    look at that I would try

    WHERE C_NARR_1 LIKE "[Deposit Slip No.]%" & [colAccNo]

    also

    does msaccess use the * as wildcards
    and the % is used in web pages
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yes, everything inside the quotes here is a literal string. Access indeed does use the asterisk as the wildcard character.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Quote Originally Posted by StarTrekker
    Access indeed does use the asterisk as the wildcard character.
    Most of the time. Jet and DAO use *, ADO uses %.
    Paul

  6. #6
    Join Date
    Mar 2008
    Posts
    29

    Smile query

    hi,
    Thank you to all i got it.

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Another happy "customer"
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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