SQL statement needed

Discussion in 'Access VBA Modules' started by JohnP, Sep 19, 2011.

  1. JohnP

    JohnP Guest

    I am trying to update field tblTo.strAdd based on the values of
    tblFrom.str1 and tblTo.str1, with a single SQL statement (probably
    faster that regular vba code)

    Assume tblFrom.str1 has only one record where string field
    tblFrom.str1 = 456

    tblTo.str1 has string fields 456234, 456789, 4522, 458, 456 with
    tblTo.strAdd being blank in every case.

    I would like to use a single SQL statement to update tblTo.strAdd
    with
    the value 456 for all tblTo.str1 that BEGIN WITH 456, in this case we
    will update the 3 records where tblTo.str1 is 456234, 456789, 456

    I tried using something like the following in the WHERE of an UPDATE
    but with no success

    (tblTo.str1 LIKE ' " & strValue & "%' )
    where strValue = "456"

    The above is ADO. For DAO I would use * instead of %

    Any ideas?
     
    JohnP, Sep 19, 2011
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. On-line Liz
    Replies:
    3
    Views:
    134
    on-line liz
    May 16, 2004
  2. tota
    Replies:
    1
    Views:
    214
    Andi Mayer
    Dec 12, 2004
  3. Mike
    Replies:
    4
    Views:
    223
  4. Mike

    Newbie: Access SQL and SQL and MS SQL

    Mike, Nov 16, 2006, in forum: Access VBA Modules
    Replies:
    4
    Views:
    262
    Granny Spitz via AccessMonster.com
    Nov 18, 2006
  5. Mel

    VBA/SQL Help Needed On Union Query

    Mel, Aug 27, 2007, in forum: Access VBA Modules
    Replies:
    0
    Views:
    88
  6. Cyberwolf0000 via AccessMonster.com

    OpenRecordset SQL using wrong SQL statement

    Cyberwolf0000 via AccessMonster.com, Dec 29, 2008, in forum: Access VBA Modules
    Replies:
    7
    Views:
    234
    Tony Toews [MVP]
    Jan 1, 2009
  7. Ikenest

    SQL Help Needed

    Ikenest, Jan 6, 2009, in forum: Access VBA Modules
    Replies:
    3
    Views:
    75
    Ikenest
    Jan 6, 2009
  8. mattc66 via AccessMonster.com

    SQL Syntax Help Needed

    mattc66 via AccessMonster.com, May 7, 2009, in forum: Access VBA Modules
    Replies:
    7
    Views:
    81
    mattc66 via AccessMonster.com
    May 7, 2009
Loading...