Field=Julian Date

G

Guest

I would like a field in a table to be recorded as a julian date for the date
entered.

So whether I enter a date from 2003 or 2007, the field would record the date
as
03-abc
or
07-abc
 
K

Ken Snell \(MVP\)

It may be better to store the normal date in the field, then you can use a
function at any time to "convert" it to a Julian date and display that
Julian date. That way, you can use the date values for other things without
having to convert from Julian to regular date.
 
J

John W. Vinson

I would like a field in a table to be recorded as a julian date for the date
entered.

So whether I enter a date from 2003 or 2007, the field would record the date
as
03-abc
or
07-abc

You can *display* a date as 07-006 or 07-358 using an expression

Format([dte], "yy") & Format(DatePart("y", [dte]), "\-000")

where dte is the date/time field.

John W. Vinson [MVP]
 
T

Tim Ferguson


You can *display* a date as 07-006 or 07-358 using an expression

Format([dte], "yy") & Format(DatePart("y", [dte]), "\-000")

? format(date(),"yy-y")
07-64


.... but I can't work out how to get the leading zeroes into the day number
without a compound expression like yours.

B Wishes


Tim F
 
J

John W. Vinson


You can *display* a date as 07-006 or 07-358 using an expression

Format([dte], "yy") & Format(DatePart("y", [dte]), "\-000")

? format(date(),"yy-y")
07-64


... but I can't work out how to get the leading zeroes into the day number
without a compound expression like yours.

That's "y" I did it that way! <g>

John W. Vinson [MVP]
 
G

Guest

I'd like to have a number automatically populated based on the Julian Date.
I set a text box format to: =IIF(date())=([Julian
date]),([Awd_Order_no]+1),1) in hopes of accomplishing the following:
If todays date is the same date as the last record, then add one to the last
record, and record this value in my table. Otherwise, make the value
automatically 1 (and I'm hoping this will be recorded in my table).

John W. Vinson said:
07-abc

You can *display* a date as 07-006 or 07-358 using an expression

Format([dte], "yy") & Format(DatePart("y", [dte]), "\-000")

? format(date(),"yy-y")
07-64


... but I can't work out how to get the leading zeroes into the day number
without a compound expression like yours.

That's "y" I did it that way! <g>

John W. Vinson [MVP]
 
T

Tim Ferguson

=?Utf-8?B?ZnJhbmtsaW5idWtvc2tp?=
I'd like to have a number automatically populated based on the Julian
Date.

Just use today's date as a datetime value and use the format property to
display it.
I set a text box format to: =IIF(date())=([Julian
date]),([Awd_Order_no]+1),1)

This will display the number 1 if the [Julian Date] field is the same as
today; otherwise it will display the contents of Awd_Order_No with one
added to it. I'm not sure that is what you want.
in hopes of accomplishing the following:
If todays date is the same date as the last record, then add one to
the last record,

There is no such thing in R as the "last" record. Last is only meaningful
according to some sort order, which could be the highest PK value, or the
most recent record created by the current user, or the most recent record
added to the table, or the lowest in the alphabet, or whatever. Tables do
not have any intrinsic ordering.
and record this value in my table. Otherwise, make
the value automatically 1 (and I'm hoping this will be recorded in my
table).

I guess what you are trying to do is to create a custom autonumber --
there are plenty of examples of how to do this around. Either google
something like "MS Access Custom Autonumber". I was about to suggest you
look at Dev's Access Web on http://www.mvps.org/access but (unless I
missed it) I can't actually find it there.

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top