473,789 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combination of Date and Day in DateAdd

peeaurjee
34 New Member
Hello,

I have a query containing Serial, Name, Residence Visa Expiry Date in MS Access 2003. I need to put Residence Visa Registration Date in other field and that would be in reverse I mean 3 years and 1 day back. For Example;

Residence Visa Expiry Date = 20/12/2010
Residence Visa Registration Date = 21/12/2007

The above one is the result I want, means expiry date is 3 years and 1 day before the registration date.

What I tried is;

Registration Date: DateAdd("yyyy",-3,[Residence Visa Exp Date])

which gives me,

Residence Visa Expiry Date = 20/12/2010
Residence Visa Registration Date = 20/12/2007

That I don't want and I tried to add "dd",1 like part of syntaxes but I failed.
Please help me regarding this problem.
Aug 13 '08 #1
4 1700
hjozinovic
167 New Member
Hello,

I have a query containing Serial, Name, Residence Visa Expiry Date in MS Access 2003. I need to put Residence Visa Registration Date in other field and that would be in reverse I mean 3 years and 1 day back. For Example;

Residence Visa Expiry Date = 20/12/2010
Residence Visa Registration Date = 21/12/2007

The above one is the result I want, means expiry date is 3 years and 1 day before the registration date.

What I tried is;

Registration Date: DateAdd("yyyy",-3,[Residence Visa Exp Date])

which gives me,

Residence Visa Expiry Date = 20/12/2010
Residence Visa Registration Date = 20/12/2007

That I don't want and I tried to add "dd",1 like part of syntaxes but I failed.
Please help me regarding this problem.
Your second try should use only one "d" like this (query):
Expand|Select|Wrap|Line Numbers
  1. Registration Date: DateAdd("d";1;DateAdd("yyyy";-3;[Residence Visa Exp Date]))
Aug 13 '08 #2
peeaurjee
34 New Member
Your second try should use only one "d" like this (query):
Expand|Select|Wrap|Line Numbers
  1. Registration Date: DateAdd("d";1;DateAdd("yyyy";-3;[Residence Visa Exp Date]))
Thank You Very Much.....It worked.

Thanks once again..
Aug 14 '08 #3
aprpillai
23 New Member
But why nesting of both Formula?

DateAdd("yyyy",-3,[Residence Visa Exp Date])+1 will give you the same result.

a.p.r. pillai
** Link Removed **
Aug 15 '08 #4
NeoPa
32,579 Recognized Expert Moderator MVP
Some people prefer to code without relying on the numerical equivalences of date values to numbers.

We know that a day is a single unit when stored as an Access date, but is it guaranteed always to be so?
Aug 20 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4201
by: Chumley the Walrus | last post by:
I'm trying to use DatePart and Datediff functions to show the formatted m/dd/yyyy display for the dates of Monday and Friday of the current week. I want it to display as: Our Weekly Schedule 8/23/2004 thru 8/27/2004: Can't pinpoint the parameter to check for the current week. Is there a good reference anywhere to show how to use the methods and such of both datepart and datediff, or has anyone programmed something similar prior.
1
17335
by: Raghu | last post by:
Hello... I am running into a problem while running a query..can some1 help.. this is the query : ************** SELECT * from Table S where S.dtDate1 BETWEEN dateadd(year,1,dateadd(month,-1,getdate())) AND dateadd(day,-1,(dateadd(month,1,dateadd(year,1,dateadd(month,-1,getdate()))))) *************** (first part of the date calculation comes out to be '2005-05-01' and
9
2636
by: Thomas R. Hummel | last post by:
Hello, I am importing data that lists rates for particular coverages for a particular period of time. Unfortunately, the data source isn't very clean. I've come up with some rules that I think will work to clean the data, but I'm having trouble putting those rules into efficient SQL. The table that I'm dealing with has just under 9M rows and I may need to use similar logic on an even larger table, so I'd like something that can be made...
3
6977
by: Paolo | last post by:
I have a query with a field named RECEIVED in which I have the following criteria: >=DateAdd('d',-Day(Date())+1,Date()) This Criteria returns all records which show a starting with the 1st day of the current month. I would now like to restrict this criteria only to the records showing a date within the month range (ex. from 11/01/2003 until 11/30/2003).
2
315
by: Jonny | last post by:
Hello, I have a DB, which when I enter a date into the DateTo field, a box is populated with a Cut Off Date (this cut off date is held in a table against each week). For example, the table would be : WeekEnding - CutOff 25/06/04 - 10/05/04 02/07/04 - 08/06/04 and so on....
4
14914
by: IsdWeb | last post by:
Hello, I am a newbie to coding and need some help. I am trying to figure out why the following code is not producing the correct Julian date. Any suggestions? Also, I am trying to understand the syntax liek what does DateAdd mean? If anyone can offer some good tutorials it would be appreciated as well. Thanks in advance.
4
3170
by: Simon Gare | last post by:
Hi all, I am trying to retrieve a count of booking entries made 30 days ago, below is the end of the query I am having problems with. dbo.booking_form.TimeOfBooking = DATEADD(day, -30, GetDate()) GROUP BY dbo.booking_form.TimeOfBooking") When I use the = sign the error reads
1
2486
by: bhavu10 | last post by:
i got date parameter but it shows only 2007 records and not for other year and would like to know where i have writte code wrong it shows month only from 1/3/2007 to 2/4/2007 not able to figureout y. Option Compare Database Private Sub cmdMonth_Click() Public Function fncFirstofMonth(dtmDate As Date) As Date Dim dtmResult As Date fncFirstofMonth = DateSerial(Year(dtmDate), Month(dtmDate), 1)
8
2781
by: Dr Al | last post by:
I have a table with four date fields, some of which may not be filled in based on our data entry needs. I have a criteria set as <date()-180 which is supposed to pull dates older than 180 days ago. The problem is that when I use that criteria for all four fields I am not getting the expected results. I am trying to find out from this query is the date in date field one is older than 180, same thing for the other three date fields. For...
0
9666
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
10412
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10142
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
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
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
6769
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
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
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
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.