Results 1 to 6 of 6
  1. #1
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40

    column has only day, want to replace it in complete Date format

    I have a table with the three fields (start date, end date, quantity)
    start date values are (1,1,3,5,1,2,6)
    end date values are (7,7,9,12,7,3,5)
    quantity values are (30,40,120,70,15,23,47)

    I want to covert the start date values into 1st March 2012, 1st March 2012, 3rd March 2012, 5th March 2012, 1st March, 2012, 2nd March, 2012

    Similarly, I want to convert the end date values also like (7th March 2012, 7th March 2012, 9th March 2012, 12th March 2012, 7th march 2012, 3rd March 2012, 5th March 2012)



    Is it possible using query?

  2. #2
    Join Date
    Apr 2012
    Location
    Los Angeles
    Posts
    75
    Are your start and end dates always going to be March 2012? How is the data getting into the table?
    Query would be like this:
    SELECT "March " & [Start Date] & " 2012" AS DateText
    FROM YourTableName

    But it sounds like you just need to modify your table by either adding a month and a year column, or changes your start and end date fields to a datetime format.

  3. #3
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40
    Thanks. But I have got one problem. In [start date] column, some values are blanks. It still writes "march 2012" in such cases. I want to keep them just blanks.

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Meanwhile, just check if below gives some guidelines :
    Code:
    SELECT 
    	Start_Date, 
    	IIf(IsNull([Start_Date]),"",Format(DateSerial(2012,3,[Start_Date]),"mmm d yyyy")) AS NewStartDate
    FROM MyTable;
    Thanks

  5. #5
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40
    It worked. Thanks mate..

  6. #6
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40
    But when I try to update the above in the table, it shows error

    update table2 set [start date] = iif(ISNULL([start date]),"",FORMAT(DATESERIAL(2012,3,[start date]),"dd-mm-yyyy"))

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

Similar Threads

  1. Replies: 6
    Last Post: 07-25-2012, 06:42 AM
  2. Date field not in date format
    By Lorlai in forum Access
    Replies: 11
    Last Post: 06-27-2011, 05:14 PM
  3. Replies: 3
    Last Post: 06-20-2011, 03:09 PM
  4. Replies: 20
    Last Post: 02-14-2011, 10:55 AM
  5. Replies: 1
    Last Post: 04-15-2010, 02:07 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