Results 1 to 5 of 5
  1. #1
    guillermoftw is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    13

    Choosing what table to update base on column value

    Hello All,

    I'm running into a little bit of a runt. Based off 1 of 2 values in column will decide what table will be opened and updated. Updating is the easy part I'm just not sure how to basically write an IF statement in SQL.



    Any help would be appreciated.

    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    The question implies a normalization problem (why multiple tables?), but you won't be able to do this directly in a query. You would have to use code to either build a query or choose one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    guillermoftw is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2014
    Posts
    13
    I have info stored in two different tables that need to be separated but depending on the value that is in the excel sheet imported will decide what table is updated. I am attempting to build a vba function to run SQL depending on a columns value. We'll see how this works out.

  4. #4
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    as pbaldy said it should be normalization issue. but still if u want to do it anyhow ,.. u can build a dynamic query and achieve the results. If then would be a choice or in better ways select case can do the job. I dont know what u want to achieve exactly but hope this helps.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Access query object cannot be dynamic for the table. Maybe in SQL or Oracle database, but not in Access.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 8
    Last Post: 10-03-2013, 08:11 AM
  2. Replies: 4
    Last Post: 09-04-2013, 06:40 AM
  3. Replies: 11
    Last Post: 08-10-2012, 10:25 PM
  4. Replies: 1
    Last Post: 12-16-2011, 08:16 AM
  5. update data base in access
    By freddyraf in forum Access
    Replies: 3
    Last Post: 11-06-2009, 07:01 PM

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