Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic updating Date to Julin Date Conversion 2

Status
Not open for further replies.

Wildbill388

Technical User
Jul 7, 2013
11
US
Hello,

I have a form that I need to have an auto updating date box in, which would be logged with the info entered into the form. I also need it to be in Julian date format. e.g. todays date 7/7/2013 would be 13188. How would I go about doing this?

 
Hi,

Your 188 is...
Code:
Date()-dateSerial(Year(Date())-1,12,31)

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
How about Format(Date(),"YYy") ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Or

Format(Date(),"YY") & format(format(Date(), "y"),"000")
 
Strongm is right for the padding with zero.
Another way:
1000*Format(Date(),"YY")+Format(Date(), "y")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry if the question was vague. Let me explain in better detail. I have forgotten how to setup the text box in the form for the date, and I don't know where to implement the techniques you guys provided. On the database I'm currently trying to reproduce there are separate date and time text boxes. Upon opening the form both boxes automatically update to the current date and time. I don't have access to the old database to reference settings from. I also don't have experience in code writing. I've tried looking online for instructions and have only found code entries, rather than instructions on code implementation. Any assistance is appreciated.

Thank you
 
Upon opening the form both boxes automatically update to the current date and time
Perhaps the DefaultValue property of the boxes ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I don't think so. Its a simple text box used for auto updating. I think there's a setting change somewhere. I know that they started by putting the text box then edit it somehow to show the time or date. How, I don't remember. And out of curiosity, what do the different parts of "1000*Format(Date(),"YY")+Format(Date(), "y")" mean. Knowing that will help me learn the system.
 
What exactly are you attempting to store in your table? If you are storing the date, there is no reason to also store the Julian date since it can easily be displayed by formatting the date value.

Duane
Hook'D on Access
MS Access MVP
 
No not at all. I just need the Julian date to be stored but also for it to auto update in the box when the form is opened. When someone accesses the form the two boxes that should be automatically filled with current info are the date(Julian) and time. When the form is submitted they should be stored with the rest of the form data. I understand the confusion with my earlier explanations but I'm only looking for one date box.
 
If the record is new, you set the default value to one of the suggested expressions. If the record is not new, you will need code in the on current event to set the values of the text boxes using the expressions.

Duane
Hook'D on Access
MS Access MVP
 
BTW found the auto update setting.
>Select text box >Properties >Data Tab >Default Value "..." >Under Expression Elements: Functions: Built-In Functions >Under Expression Categories: Date/Time >Under Expression Values: Date$

Repeat process on Event Tab: Before Update "..."

So... First problem is solved. Now I just need to find out how to make it appear in Julian instead of calendar date. If it involves code building I'll need instructions if possible. Thanks
 
>Data Tab >Default Value "..." >
So, seems like you followed my suggestion posted 7 Jul 13 17:56

I just need the Julian date to be stored
What is the data type of the field storing that value ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes it required that and the same under the Before Update setting. But It wouldn't work with only one of those, had to do both, not sure why. But that explains why I couldn't find it. Two settings had to match. After reading your post I went looking in that direction. Thanks for the lead.
 
What is the data type of the field storing that value?
I'm not quite sure what you're asking. I'm not very knowledgeable in the "language" surrounding access, so I need a little extra info on what to look for. Do you mean how the form information is going to be stored?


Thanks
 
The value will be stored in a field in a table, right ?
How is defined this field in that table ? (date,string,numeric, ...)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I think its currently Date. Should it be Date or otherwise for Julian?
 
A date is a date!
So, store the value as a date and display/print it using a format.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top