Results 1 to 7 of 7
  1. #1
    linvall is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    29

    Filed Name/column Header As Current Date

    Hello,

    I am currently trying to create a query that displays the column header as the current date. I would also like a few more headers with previous dates (date()-1, date()-2, etc...). I've been trying to input "Date()" in the header field but when I run the query, it displays "Date()" as the column header instead of the current date. Is there a way to accomplish such a thing? Thanks.


  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Perhaps you should start by showing us the SQL of the query you are developing.

  3. #3
    linvall is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    29
    Here's what i got, pretty simple but it doesn't want to work. I need the actual date (Ex. 1/28/2019) to show up as the header.

    Code:
    SELECT [All Backlog WOs].WORK_ORDER_NBR AS [Date()], [All Backlog WOs].WW AS [Date()-1], [All Backlog WOs].WO_STATUS AS [Date()-2]
    FROM [All Backlog WOs];
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	8 
Size:	16.7 KB 
ID:	37161
    Click image for larger version. 

Name:	Capture3.PNG 
Views:	8 
Size:	14.7 KB 
ID:	37162

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    OK. Start with a clear description of what you are trying to accomplish in simple English
    --no jargon and no database terms.

    Date is a very explicit thing in Access. Separate datatype with various formats and specific internal storage.
    I see 3 different formats in your use of Date(), Date()-1, Date()-2. These do not represent Calendar dates, so more info is needed.

  5. #5
    linvall is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    29
    I need my column headers to be displayed as the current date, yesterday's date, two days ago and so on and so forth. Basically, a set of data will be in each column, depending on the date. For example, if I'm considering the first column to be the current date, the filed name should be "1/28/2019" or "28-Jan-2018" (the format doesn't really matter). The second column name would be "1/27/2019", for yesterday's date and so on and so forth.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    This is the best I could do in a few tries. Have to live with the Exp

    Code:
    Select " " & Date() as ""," " & Date()-1 as " " , " " & Date() -2 as "  " from YourTableName
    Union SELECT YourField1, YourField2, YourField3
    FROM YourTableName;
    My sample with my table

    Code:
    Select " " & Date() as ""," " & Date()-1 as " " , " " & Date() -2 as "   " from AnimalLocs
    Union SELECT SightingDate , GPSLat, GPSLong
    FROM AnimalLocs;
    gives result
    Code:
    """"""	""" """	"""   """              <-------I couldn't get rid of these and still get the dates
     28-Jan-19	 27-Jan-19	 26-Jan-19
    02-Dec-09	45.32	78.44
    13-Mar-09	48.9	76.33
    14-Sep-10	49.3	77.7
    17-Sep-10	48.9	77.334456
    21-Apr-10	47.52	78.23
    21-Apr-10	47.54	78.53
    23-Apr-10	47.66	78.666
    24-Aug-09	49.4	76.2
    27-Mar-09	47.3	77.9
    28-Mar-09	46.8	77.34
    29-Mar-09	48.8	77.45

  7. #7
    linvall is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    29
    Alright, I'll take a look into this tomorrow, thank you.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-12-2017, 02:30 AM
  2. Replies: 4
    Last Post: 11-16-2015, 08:15 AM
  3. Replies: 2
    Last Post: 08-12-2012, 10:56 AM
  4. Replies: 7
    Last Post: 02-10-2012, 08:08 PM
  5. tRNASFER text FILEd INTO DATE FORMAT
    By BorisGomel in forum Access
    Replies: 1
    Last Post: 01-05-2012, 10:08 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