Results 1 to 3 of 3
  1. #1
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199

    Update query

    I Have two tables:

    DE Code
    -------- ---------
    id PK id PK
    orig FK ref id code cod
    Dest FK ref id code flag


    flag

    here the code tables have column flag entry as 0 or 1

    Problem is if either one of orig and dest have flag entries as 1 or both have 1 i want to update the flag in DE table as 1 or else 0. Can i acheive that by using a query, Please help

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    well no one has answered probably because the layout of your 2 tables is scrambled to make it really difficult to understand..... but presuming that field 'id PK' is the join field between the two tables......then you don't actually need to record the 'flag' field in the DE table because it is calculate-able.....and thus always available to you already. In a query you would have this field:

    DEflag: iif(DE.orig=-1 or Code.dest=-1,-1,0)

    so that is an IIF statement - you'll want to look that up to understand that syntax....which returns -1 (or yes in a yes/no field) if the 'Orig' field in the DE table is checked or if the 'dest' field in the Code table is checked....

    I've made some assumptions on what the field names are because your table info is all scrambled....and when you say a 'flag entry' I am assuming that means -1 in a check box yes/no field type......

    hopefully this helps.....

  3. #3
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    Thanks for response NIC, as i got the way for it, this is added to my information for use, thanks a ton

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

Similar Threads

  1. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  2. Replies: 1
    Last Post: 05-17-2013, 12:53 PM
  3. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  4. Replies: 4
    Last Post: 11-10-2011, 03:41 PM
  5. Replies: 1
    Last Post: 08-19-2011, 12:16 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