473,666 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Yea r(date()),1,1)
Can someone help me out?
Thanks in advance,
john
Jan 27 '07 #1
4 5201
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.comw rote 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(Yea r(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(Yea r(date()),1,1) doesn't work.
=dateserial(Yea r(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(Ye ar(date()),1,1) ")
Here the comma's do work. Does this have to to with the quotation marks?

john
"Allen Browne" <Al*********@Se eSig.Invalidsch reef 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.comw rote 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(Ye ar(date()),1,1)
Can someone help me out?
Thanks in advance,
john

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

I found the problem:
=dateserial(Yea r(date()),1,1) doesn't work.
=dateserial(Yea r(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(Ye ar(date()),1,1) ")
Here the comma's do work. Does this have to to with the quotation
marks?

john
"Allen Browne" <Al*********@Se eSig.Invalidsch reef 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.comw rote 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(Yea r(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 decimalseparato r, 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 "interprete d" 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.noschre ef in bericht
news:mn******** *************** @yahoo.no...
"john" <jo**@test.comw rote in message
<se************ *********@casem a.nl>:
>Thanks.
>>If you have that in the Control Source of the text box, it should
work fine.

I found the problem:
=dateserial(Ye ar(date()),1,1) doesn't work.
=dateserial(Ye ar(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(Ye ar(date()),1,1) ")
Here the comma's do work. Does this have to to with the quotation
marks?

john
"Allen Browne" <Al*********@Se eSig.Invalidsch reef 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.comw rote in message
news:bI****** *************** *********@casem a.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(Yea r(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 decimalseparato r, 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 "interprete d" 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
2912
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 calcuated field. Prior to submission of the information, I would like the user to know what the calculated field be (based on the information input in text boxes) before submission of the form. Is there any way to display the calculated value...
27
1761
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
3997
by: MLH | last post by:
Fields in MyTable: PostID PostDate RollQtyXfer RollDenomination RollCount37 RollCount23
10
3913
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 SOL6M which adds 6 month to the date entered in the Occurence field, this is done with the following Controls: =DateAdd("yyyy",1,) =DateAdd("yyyy",2,) =DateAdd("m",6,) The problem is that the data in the SOL1, SOL2, and SOL6M does not show up...
5
6985
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 to complain about nulls and then about 'can't repeat an index'. To solve this I wrote code on the main form's subform enter event (I'm surprised I found it. I must have spent an hour trying to program the enter and exit events from the subform...
5
5886
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 function returns a long string. This works. 2. A query has a calculated field based on the custom function above. This works when the query is run directly.
1
2005
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 handicap), i.e. 3 fields per line in the subform showing date, score, handicap. The handicap needs to be calculated in VBA code as it is fairly complex to work out and depends on previous scores as well as the current score. I can get a query to...
11
1847
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 to show up in the report. If it's not checked, then I want it to not show. Thanks for any help!
2
8533
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 field. I know this has to be simple but I just can't get it done.
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8780
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7378
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.