Results 1 to 2 of 2
  1. #1
    pnasz is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Mar 2012
    Posts
    2

    Question changing sql qrt to access qry

    update table1
    set table1.range=case
    when table1.wt>=cast(substring(table2.range1,1,charinde x('-',table2.range1)-1) as int)
    and table1.wt<=cast(substring(table2.range1,charindex( '-',table2.range1)+1,99) as int)
    then table2.range1


    when table1.wt>=cast(substring(table2.range2,1,charinde x('-',table2.range2)-1) as int)
    and table1.wt<=cast(substring(table2.range2,charindex( '-',table2.range2)+1,99) as int)
    then table2.range2
    else table1.range
    end
    from table2
    where table2.id=table1.id

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    MAYBE:
    update table1
    set table1.range=
    IIF(
    table1.wt>=CINT(substring(table2.range1,1,INSTR(ta ble2.range1,'-')-1))
    and
    table1.wt<=CINT(substring(table2.range1,INSTR(tabl e2.range1,'-')+1,99) ), table2.range1,
    (table1.wt>=CINT(substring(table2.range2,1,INSTR(t able2.range2,'-')-1) )
    and
    table1.wt<=CINT(substring(table2.range2,INSTR(tabl e2.range2)+1,99)),table2.range2,table1.range)
    from table2
    where table2.id=table1.id

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Changing Microsoft Access Templates
    By JrMontgom in forum Programming
    Replies: 3
    Last Post: 09-24-2013, 11:02 AM
  2. Changing from access 2003 to 2007
    By ashu.doc in forum Access
    Replies: 2
    Last Post: 09-17-2012, 09:41 PM
  3. Changing the date from Excel to Access
    By Philosophaie in forum Access
    Replies: 7
    Last Post: 08-21-2012, 07:54 PM
  4. Access 2.0 files -- reading and changing
    By DerFarm in forum Import/Export Data
    Replies: 5
    Last Post: 05-23-2011, 10:07 AM
  5. Changing data in excel from access
    By ricardo9211 in forum Import/Export Data
    Replies: 1
    Last Post: 08-26-2009, 01:46 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
  •  
Other Forums: Microsoft Office Forums