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
    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. Advertisements

Ask a Question

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.