473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Showing January 1 of current year in calculated field

I have an unbound field in which I would like to show january 1 of the
current year like this 01-01-2007. I tried this code but it doesn't work:
=dateserial(Year(date()),1,1)
Can someone help me out?
Thanks in advance,
john
Jan 27 '07 #1
4 5163
If you have that in the Control Source of the text box, it should work fine.

Set the Format property of the text box so that Access know to treat it as a
date. Use:
Short Date
or format it how ever you want, e.g.:
mmmm d yyyy

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"john" <jo**@test.comwrote in message
news:bI******************************@casema.nl...
>I have an unbound field in which I would like to show january 1 of the
current year like this 01-01-2007. I tried this code but it doesn't work:
=dateserial(Year(date()),1,1)
Can someone help me out?
Thanks in advance,
john
Jan 27 '07 #2
Thanks.
If you have that in the Control Source of the text box, it should work
fine.
I found the problem:
=dateserial(Year(date()),1,1) doesn't work.
=dateserial(Year(date());1;1) does.

Strangely enough I have another unbound field in another form in this app
with the code:
=DSum("[Bedrag]";"Transactie";"[Rentedatum]>=dateserial(Year(date()),1,1)")
Here the comma's do work. Does this have to to with the quotation marks?

john
"Allen Browne" <Al*********@SeeSig.Invalidschreef in bericht
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
If you have that in the Control Source of the text box, it should work
fine.

Set the Format property of the text box so that Access know to treat it as
a date. Use:
Short Date
or format it how ever you want, e.g.:
mmmm d yyyy

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"john" <jo**@test.comwrote in message
news:bI******************************@casema.nl...
>>I have an unbound field in which I would like to show january 1 of the
current year like this 01-01-2007. I tried this code but it doesn't work:
=dateserial(Year(date()),1,1)
Can someone help me out?
Thanks in advance,
john

Jan 27 '07 #3
"john" <jo**@test.comwrote in message
<se*********************@casema.nl>:
Thanks.
>If you have that in the Control Source of the text box, it should
work fine.

I found the problem:
=dateserial(Year(date()),1,1) doesn't work.
=dateserial(Year(date());1;1) does.

Strangely enough I have another unbound field in another form in this
app with the code:
=DSum("[Bedrag]";"Transactie";"[Rentedatum]>=dateserial(Year(date()),1,1)")
Here the comma's do work. Does this have to to with the quotation
marks?

john
"Allen Browne" <Al*********@SeeSig.Invalidschreef in bericht
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
>If you have that in the Control Source of the text box, it should
work fine.

Set the Format property of the text box so that Access know to treat
it as a date. Use:
Short Date
or format it how ever you want, e.g.:
mmmm d yyyy

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"john" <jo**@test.comwrote in message
news:bI******************************@casema.nl.. .
>>>I have an unbound field in which I would like to show january 1 of
cthe urrent year like this 01-01-2007. I tried this code but it
doesn't work: =dateserial(Year(date()),1,1)
Can someone help me out?
Thanks in advance,
john
I think it has partly to do with the quote marks. Here are some
thoughts on what I think happens.

First, the reason for comma not working, is that in some locale, comma
is used as decimalseparator, and therefore cannot be used as arguement
separator in expressions, controlsources etc in the interface (also
Excel formulas). We have to use semicolon.

In the second sample, you're passing three different arguements to the
domain aggregate function. Those three needs to be separated by
semicolon, as they are "interpreted" in the interface, where your
locale settings take precedence.

But the last part, the criterion, is a *string* passed to the domain
aggregate function. I think what follows next, is that this string is
passed to, and evaluated by the Jet expression service, which I believe
needs US/unambiguous format on what is passed.

Some of this can be observed when you work with queries. When working
in design view, you will have your format, your delimiters and
separators, if you switch to SQL view, you will see the same
expressions in US format.

--
Roy-Vidar
Jan 27 '07 #4
Roy, thanks for the explanation.
john

"RoyVidar" <ro*************@yahoo.noschreef in bericht
news:mn***********************@yahoo.no...
"john" <jo**@test.comwrote in message
<se*********************@casema.nl>:
>Thanks.
>>If you have that in the Control Source of the text box, it should
work fine.

I found the problem:
=dateserial(Year(date()),1,1) doesn't work.
=dateserial(Year(date());1;1) does.

Strangely enough I have another unbound field in another form in this
app with the code:
=DSum("[Bedrag]";"Transactie";"[Rentedatum]>=dateserial(Year(date()),1,1)")
Here the comma's do work. Does this have to to with the quotation
marks?

john
"Allen Browne" <Al*********@SeeSig.Invalidschreef in bericht
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
>>If you have that in the Control Source of the text box, it should
work fine.

Set the Format property of the text box so that Access know to treat
it as a date. Use:
Short Date
or format it how ever you want, e.g.:
mmmm d yyyy

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"john" <jo**@test.comwrote in message
news:bI******************************@casema.nl. ..
I have an unbound field in which I would like to show january 1 of
cthe urrent year like this 01-01-2007. I tried this code but it
doesn't work: =dateserial(Year(date()),1,1)
Can someone help me out?
Thanks in advance,
john

I think it has partly to do with the quote marks. Here are some
thoughts on what I think happens.

First, the reason for comma not working, is that in some locale, comma
is used as decimalseparator, and therefore cannot be used as arguement
separator in expressions, controlsources etc in the interface (also
Excel formulas). We have to use semicolon.

In the second sample, you're passing three different arguements to the
domain aggregate function. Those three needs to be separated by
semicolon, as they are "interpreted" in the interface, where your
locale settings take precedence.

But the last part, the criterion, is a *string* passed to the domain
aggregate function. I think what follows next, is that this string is
passed to, and evaluated by the Jet expression service, which I believe
needs US/unambiguous format on what is passed.

Some of this can be observed when you work with queries. When working
in design view, you will have your format, your delimiters and
separators, if you switch to SQL view, you will see the same
expressions in US format.

--
Roy-Vidar


Jan 27 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jack | last post by:
Hi, I have a asp input form of a financial report. Here most of the fields are text boxes where the user need to input the values corresponding to an item. However, there are few items which are...
27
by: mark | last post by:
Jan 1st, 1 AD was Sunday or Saturday ? (question is related to C as I am writing a program (in C) to calculate days/dates and need a starting point from where to start counting.)
2
by: MLH | last post by:
Fields in MyTable: PostID PostDate RollQtyXfer RollDenomination RollCount37 RollCount23
10
Cyberdyne
by: Cyberdyne | last post by:
Here is the problem, I have a form with a field named Occurence with a Short Date Value, once entered it subsequently appears in 3 fields SOL1 which adds one year, SOL2 which adds 2 years and...
5
by: christianlott1 | last post by:
I admit my form is pretty complex and may need a total overhaul - I have two subforms synchronized on a form through an unbound text box. When I enter a new record in the second subform it used...
5
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public...
1
by: Colin Clark | last post by:
Hello, I have a database of scores for a sports club. I want to display a continuous subform showing a person's scores for the season along with a running calculation based on those scores (the...
11
by: radink | last post by:
Hey All, I have a report that I would like to show a word on based on if a field is checked in a form. For example. The form has a check box called Fee. If that is checked, I want the word Paid...
2
by: clloyd | last post by:
I have a form that when you hit a command button it moves the current year value (could be three years prior) to a previous year field. I need code to insert the current year in the current year...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.