473,386 Members | 1,712 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,386 software developers and data experts.

Access Future Date Query

I need to use a dateadd funtion based on values in a table.
E.G 1,2,3,4,5,6,= add 2 years 7,8,9,10,11,12,13,14 ,15 or 19 = ad 3 years 16,17,18 = add 5 years. These are added to an entered date.
I see that to add a date is =DateAdd("y", 2,[txtdate]) but I am looking for a multiple choice function.
Mar 13 '07 #1
3 1796
MMcCarthy
14,534 Expert Mod 8TB
I need to use a dateadd funtion based on values in a table.
E.G 1,2,3,4,5,6,= add 2 years 7,8,9,10,11,12,13,14 ,15 or 19 = ad 3 years 16,17,18 = add 5 years. These are added to an entered date.
I see that to add a date is =DateAdd("y", 2,[txtdate]) but I am looking for a multiple choice function.
You don't say the name of your field that holds these values or if it is available on your form. Assuming it is on the form and is called txtValue then ...

Expand|Select|Wrap|Line Numbers
  1. =DateAdd("y", [txtValue], [txtdate])
Mary
Mar 13 '07 #2
I would suggest using an "If/Then/Else" or a "Select Case" ie.:
Expand|Select|Wrap|Line Numbers
  1. If [tbl_value] is < 7 Then [MyDate] = DateAdd("yyyy",2,[OriginalDate]) 
.

It might be more elegant to declare your interval as a string and use the IF or Select Case to set the value.
Expand|Select|Wrap|Line Numbers
  1. DateAdd("yyyy",MyString,[OriginalDate])
.

I hope I'm not being to vague. It's 0530 at the tail end of a night shift for me.
Good Luck
Hope it's of some help.
Mar 13 '07 #3
NeoPa
32,556 Expert Mod 16PB
I need to use a dateadd funtion based on values in a table.
E.G 1,2,3,4,5,6,= add 2 years 7,8,9,10,11,12,13,14 ,15 or 19 = ad 3 years 16,17,18 = add 5 years. These are added to an entered date.
I see that to add a date is =DateAdd("y", 2,[txtdate]) but I am looking for a multiple choice function.
You could use Choose() :
Expand|Select|Wrap|Line Numbers
  1. =DateAdd("y",Choose([DJSValue],2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,5,5,5,3),[txtDate])
Mar 15 '07 #4

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

Similar topics

7
by: Bob | last post by:
Currently I am using this statement to translate 3 fields in my db thru Visual Basic. I import the data from one table to another then call the IFF statements and the NewDate to translate the...
4
by: bhbgroup | last post by:
I have a query on one large table. I only add one condition, i.e. a date (the SQL reads like 'where date > parameterdate'. This query is rather quick if 'parameterdate' is either explicitly...
14
by: Crimsonwingz | last post by:
Need to calculate a sum based on a number of factors over a period of years. I can use formula ^x for some of it, but need totals to carry over in the sum and have only been able to do this thus...
2
by: asreryll | last post by:
I wish to show a future date in a table, so that I can sort and know which case is in need of a review. I can display a future date in a form but I want to see all records that are due on a certain...
5
by: m_t_hill | last post by:
Running MS Access 2000 MS Windows XP Pro This has caused me a lot of hair loss in the last few days so would appreciate any help. I am running code to append/update a local access database...
2
by: audiophilechris | last post by:
Can anyway help me write this query? I've created a DB to help me manage delivery logistics for items I rent out. I have a table that i use to record delivery date, delivery time, pickup date,...
4
by: keri | last post by:
Hello again, While I try and solve the calender issue I also have another problem. I have a form & table (appointments) where the user records appointments in the future. The fields include...
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
3
by: Harlequin | last post by:
I must start this posing by making the point that I am NOT a VB programmer and I'm something of a Newbie to MS Access. I can program in a number of languages (Java, Javascript, PERL,PHP and TCL) but...
4
by: drrajnishpatel via AccessMonster.com | last post by:
Dear Friends i am trying to get a future date as follows, data:1) date of proceeding to leave = D 2) number of days leave sanctioned =N 3) date of reporting for duty =R i grant "n" number of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
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...

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.