Results 1 to 7 of 7
  1. #1
    jghumphrey is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    3

    Can I create a conditional field name in a query?

    SELECT temp.BusName, temp.Jan, temp.Feb, temp.Mar


    FROM temp
    WHERE temp.[Forms]![frmNoReport]![MoName]=True;

    frmNoReport is open, MoName equals Jan, Feb, or Mar but the WHERE does not equate to a field name and asks for input. It then displays all records instead of the 'True' records.
    Last edited by jghumphrey; 02-04-2015 at 12:44 PM. Reason: Clarification

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    No, cannot have conditional field name in a query object.

    The month name fields are all Yes/No data type?

    This does not appear to be normalized data structure. Can each record have only one month field selected as True? If so, this should be one field with 12 options. If not, should be a related table.
    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.

  3. #3
    jghumphrey is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    3
    Each record has 12 month fields which can be checked in any combination, all Yes/No.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Comments still apply.

    A UNION query could rearrange the data to a normalized structure. Then use that query like a table to filter and aggregate data.
    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.

  5. #5
    jghumphrey is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    3
    I was able to simplify and solve the problem with a multi-valued field. Thanks.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I NEVER use multi-value fields but as long as it serves your needs, glad you have a working solution.
    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.

  7. #7
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I was able to simplify and solve the problem with a multi-valued field
    That may have got you past some hurdle, but I don't think it's a solution.

    Research Normalization and database principles -- your database activity will be more rewarding than it is.
    Principles of relational Design http://forums.aspfree.com/attachment...2&d=1201055452
    Entity Relationship Diagramming http://www.rogersaccesslibrary.com/T...lationship.zip

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

Similar Threads

  1. Conditional Query with conditional results
    By Jeff_in_KCMO in forum Queries
    Replies: 4
    Last Post: 09-10-2014, 01:44 PM
  2. Replies: 5
    Last Post: 04-04-2014, 03:33 PM
  3. How do i create a new field in a query
    By jayjayuk in forum Access
    Replies: 3
    Last Post: 10-12-2010, 09:06 AM
  4. How do i create a new field in a query
    By jayjayuk in forum Access
    Replies: 1
    Last Post: 10-12-2010, 07:25 AM
  5. Replies: 3
    Last Post: 04-26-2010, 11:38 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