Results 1 to 4 of 4
  1. #1
    campanellisj is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Posts
    11

    Julian Date Function Help Please

    I am attempting to populate a field based on the julian day the record is created.



    I need the field (ordernum) to display as follows JulianDate-000 (133-100). Where the first three digits are the Julian day and the three after the dash will increment by one when a new record is made.

    I am using the following code to generate the julian date:

    Function CDate2Julian(MyDate As Date) As String
    CDate2Julian = Format(MyDate - DateSerial(Year(MyDate) - 1, 12, _
    31), "000")
    End Function

    which is producing the correct julian date but I am unable to produce the dash or the numbers afterwards (which I need to increment by one with each new record) Am I asking to much or am I not doing this the correct way? any help would be great.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You do know that Format([MyDate],"y") returns the day of the year as a number (1-366) right?

  3. #3
    campanellisj is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Posts
    11
    yes I guess what I am trying to say is I need the order number field in the table to be a combination of "todays" julian date plus the incremented number so the end result would be: 366(julian day) - 201 (next incremented number).... 366-202, 366-203 etc

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    See if this concept appeals to you: http://www.baldyweb.com/CustomAutonumber.htm

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

Similar Threads

  1. Access 2003 Date() Function returns "#Name?"
    By smartel@soprema.ca in forum Programming
    Replies: 5
    Last Post: 01-18-2012, 05:52 AM
  2. Date Function
    By tmcrouse in forum Queries
    Replies: 2
    Last Post: 12-02-2010, 08:53 AM
  3. Date function in Terminal Server
    By eww in forum Access
    Replies: 8
    Last Post: 11-16-2010, 04:24 PM
  4. Replies: 0
    Last Post: 07-15-2010, 11:26 PM
  5. Date Past Function
    By Laney in forum Access
    Replies: 4
    Last Post: 05-21-2008, 07:19 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