Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26

    Field/coloumn headings in reports

    Hi all,

    I have a report that is generated from a query that gives me the current month as a date and then the subsequent months rolling forward as M1, M2, M3, M4 etc

    ie if current month is 2012/2/1 then M1 must be Feb, M2 Marc etc



    My question is;
    How do I get the field names/headings of the columns to change dynamically every time the report is run on a new month. I have tried date add from th month field no luck.

    Any other ideas?

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Use the format function, e.g. Format(datefield, "mmm yyyy") would give you the month name. Don't forget to use the year otherwise your data will be put together year after year.

  3. #3
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26
    Hi Aytee111,
    That does not work as the data is not in the field name it is in a seperate coloumn so it needs to reference the date from that coloum, the field names themselves m1 etc remain constant irrespective of what the date in the date coloum is.

    My logic is (simplified)

    Find date in Field.Date
    Return in M1 Field.Date +1 Format Date mm yyy. M2 would be +2 etc

    Does that make sense? the question is how

  4. #4
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    You would use Format(DateAdd("m",0,datefield),"mmm yyyy") then subsuquent months simply change the 0 to 1, 2, 3 ....

  5. #5
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26
    But how do I get it to look for the actual date in another field if it is not in the current field name?

    Have tried to attach a view of the report it currently is - Maybe it will make more sense

  6. #6
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26
    maybe this will work

  7. #7
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    First make sure the headings are textboxes not labels. Second in the controlsource property put in the format command as stated previously. based on your sample the datefield would be [mnth]

  8. #8
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26
    Thanks RayMilhon,
    I will try that and get back to you.

  9. #9
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26
    I am getting an "enter parameter" value prompt. Must be missing something

    Fixed - I forgot the []

  10. #10
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26


    Where on earth is the extra bracket?

  11. #11
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    can you post the entire SQL Statement?

  12. #12
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26
    Format(DateAdd("m",0,[Mnth]),"mmm yyyy") in the control source box as you suggested.

    If I remove the [] around the Mnth then I get teh parameter error but not the ( error

    Am I missing something?

  13. #13
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    The [] specifies to access it's a fieldname If ther is no field with that name in the query Access assumes a parameter. So Is Mnth the field name. That's why I asked for the SQL

  14. #14
    Epona is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Location
    South Africa
    Posts
    26
    Yes 'Mnth' is the field name for the field that the month/date to be selected resides in.

    I am not sure I understand what you are looking for when you ask for the sql code? If it is different to the one I posted previously then can you please advise me where to find it.

    Thanks

  15. #15
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    Took another look is Format(DateAdd("m",0,[Mnth]),"mmm yyyy") preceded by an = if not add it. Le me know

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. [SOLVED] WHERE statement in lookup coloumn
    By frksdf in forum Queries
    Replies: 3
    Last Post: 01-20-2012, 08:45 AM
  2. csv import second row contains column headings
    By dr_patso in forum Import/Export Data
    Replies: 1
    Last Post: 07-16-2011, 03:56 PM
  3. Resizing column headings
    By allykid in forum Access
    Replies: 0
    Last Post: 03-10-2011, 12:58 PM
  4. Creating headings when a field changes in a form
    By martinbanks in forum Access
    Replies: 1
    Last Post: 11-08-2010, 12:17 PM
  5. Page Headings
    By maintt in forum Reports
    Replies: 2
    Last Post: 07-22-2010, 05:18 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