Results 1 to 4 of 4
  1. #1
    hellfire45 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Mar 2015
    Posts
    24

    Help using IIF statement calculated column through Linked Table

    So I have this If statement that goes something like this;

    Code:
    IIf {ttblEQAnswer_FCLIT.ActionType} = 'Answer Affir Defense' andnot isnull({ttblEQAnswer_FCLIT.METPrep}) and not isnull({ttblEQAnswer_FCLIT.AttyInstr}) and
    ({ttblEQAnswer_FCLIT.METPrep})> date(1900,1,1) and not isnull({ttblEQAnswer_FCLIT.AttyInstr})
    and {ttblEQAnswer_FCLIT.METPrep} < currentdate - 10
    then 'Y' as [MET InstructNeed?],
    I want to use the above formula to calculate a column. However, do I need to join the tables referenced above in order to get this formula to work? As it stands I'm getting an error that says "Malformed GUID in query expression".



    What am I missing here? Thank you for the attention.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    1st, the IIF does not use braces. Use help to see the layout. IIF(condition,true,false)
    ANDNOT is not a valid operator.

    2nd, since you have a complex IF, I would simplify by adding a field MET, then run a macro that has 2 queries....
    Q1 to set MET to null
    Q2 to update it to YES if all your fields are met. No IIF needed.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Did you find these commands/functions somewhere???
    {
    date(1900,1,1)
    andnot
    currentdate

    For syntax and sample usage of Access functions please see techonthenet.

    I also recommend you review these debugging and error handling techniques by Chip Pearson. The sooner you learn these, the quicker you will become more independent.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    Code:
    MET InstructNeed: IIf( ttblEQAnswer_FCLIT.ActionType = 'Answer Affir Defense' and not isnull(ttblEQAnswer_FCLIT.METPrep) and not isnull(ttblEQAnswer_FCLIT.AttyInstr) and
    (ttblEQAnswer_FCLIT.METPrep)> #1/1/1900# and not isnull(ttblEQAnswer_FCLIT.AttyInstr)
    and ttblEQAnswer_FCLIT.METPrep < date() - 10,"Y", null)

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

Similar Threads

  1. Calculated Column in a Table
    By asmith533 in forum Programming
    Replies: 1
    Last Post: 02-10-2015, 07:53 AM
  2. Replies: 3
    Last Post: 03-14-2012, 06:48 AM
  3. alter table to add a column in a linked table
    By markjkubicki in forum Programming
    Replies: 6
    Last Post: 02-09-2012, 08:13 AM
  4. Update statement with linked table join
    By Guigui in forum Queries
    Replies: 6
    Last Post: 09-17-2010, 04:47 AM
  5. Replies: 2
    Last Post: 08-26-2009, 10:43 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