Results 1 to 7 of 7
  1. #1
    dani9 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    4

    Make column name flexible


    HI,

    does anyone know how to make the column name flexible. like for example I would need the name for July be changed each month. This is my query, or at least a part of it:

    Code:
    IIf([Start Date]<"2011-08" And [Close Date]>"2011-06",1,0) AS [2011-07],
    so i would need the last part AS [2011-07] like [Format(DateAdd("m",-2,Date()),"mmm")] but this doesn't work (it comes the same in the report).. is there another solution, I could make column name variable???

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    If you feel need to do this, sounds like database is not properly structured.
    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
    dani9 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    4
    Quote Originally Posted by June7 View Post
    If you feel need to do this, sounds like database is not properly structured.
    I have Start date column, and End date column, and I need to make columns for 12 months or more, showing if the application has been active for each month - 1 if active and 0 if not.

    If i had one column with data, i could make a pivot table, but this way with two columns is complicated for me, I don't even know if it is possible.

    Any ideas?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    Your requirement is similar to this http://forums.aspfree.com/microsoft-...st-469513.html
    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
    dani9 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    4
    I already had this query, but doesn't fit my needs, as I said I need the column name to be flexible. In this case the columns are fixed.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    Far as I know, flexible column name is not possible. If you want report to automatically recognize the changed field names and 'adjust', as in change the ControlSource property of textboxes, this will require elaborate VBA coding.
    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
    dani9 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    4
    ok, thank you anyway, I found another way around to solve my problem.

    Thanks again for trying

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

Similar Threads

  1. Replies: 1
    Last Post: 08-18-2011, 08:35 AM
  2. Search By Criteria - Flexible Criteria Fields
    By lilanngel in forum Access
    Replies: 0
    Last Post: 03-16-2011, 06:25 PM
  3. Replies: 1
    Last Post: 04-15-2010, 02:07 AM
  4. How to make a Column in Access a DropDown
    By JohnGrove in forum Access
    Replies: 4
    Last Post: 03-10-2009, 07:56 AM
  5. Adding new column to make-table query
    By dtn118 in forum Access
    Replies: 2
    Last Post: 08-03-2008, 06:51 AM

Tags for this Thread

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