473,326 Members | 2,126 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,326 software developers and data experts.

Add or subtract from a date field

11
I need to create some code that will take a particular date field, called dtefnd, and add 20 to this date with the end result being another date. I have tried just adding 20 to dtefnd in VBA procedure but I don't get a correct date. Help!
Jan 22 '08 #1
5 4520
MindBender77
234 100+
I need to create some code that will take a particular date field, called dtefnd, and add 20 to this date with the end result being another date. I have tried just adding 20 to dtefnd in VBA procedure but I don't get a correct date. Help!
I'm not quite sure what you're asking but, this might help. This is using the query builder

We know that dtefnd is a Date data type in Col1.

Col2 could be an expression: Next Date: [dtefnd] + 20

Hope This Helps,
JS
Jan 22 '08 #2
jaxjagfan
254 Expert 100+
I need to create some code that will take a particular date field, called dtefnd, and add 20 to this date with the end result being another date. I have tried just adding 20 to dtefnd in VBA procedure but I don't get a correct date. Help!
You can try

CDate(dtefnd) + 20

Is dtefnd a textbox where user is entering a date? Make sure the format of dtefnd is a date format.
Jan 22 '08 #3
Have you tried this function?
newdte = DateSerial(year([dtefnd]), month([dtefnd]), day([dtefnd])+20)
Jan 23 '08 #4
missinglinq
3,532 Expert 2GB
You should use the DateAdd() function for this. For a query you'd create a calculated field like:

AnotherDate: DateAdd("d",20, [dtefnd])

Welcome to TheScripts!

Linq ;0)>
Jan 23 '08 #5
ezra
11
Thanks for all of these.
Jan 31 '08 #6

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

Similar topics

3
by: Russ Green | last post by:
I'm trying to perform several manipulations to time values (all will be stored in a access database). I need to find the elapsed time between a start time and a finish time and I also need to be...
8
by: dlx_son | last post by:
Here is the code so far <form name="thisform"> <h3>Enter time to add to or subtract from:</h3> (If not entered, current time will be used)<br> Day: <input name="d1" alt="Day of month"...
3
by: Mo | last post by:
Is it possible to subtract a number of weeks from a specific date field in one of my queries? e.g: CalculatedDateField: MyDatefield - 10 wks Any help much appreciated.
4
by: Lee | last post by:
Hi All, I have a datetime field and want to subtract 24 (or any other number of) hours from it. How would I go about this? Thanks Lee
3
by: S. van Beek | last post by:
Dear reader, With DatePart() you can subtract the year or the week from a date field with: DatePart("yyyy";) for the year
5
by: cvisal | last post by:
Hi all Im working on productivity calculations (Time calculations) and need some help in coding. Database Tool:MS-Access 2003. The general operator punch-in time is 5:30 AM and the punch-out...
8
by: Remington | last post by:
I am using windows 2000pro with access 2000. I am trying to make a database for our HR department, that would allow our HR Director to type in an employee's ID number into a form and then select...
3
by: Arne Gemsa | last post by:
Hi, I want to get a starttime. To get this I have to subtract the runtime from a unit e.g. 08:40:15 from a date e.g. 2007-03-29 16:48:30. So the starttime is 2007-03-29 08:08:15. Is there any...
15
klarae99
by: klarae99 | last post by:
I am working on an Inventory Database in Access 2003. I am working on a report that I could print when its time to file our State Sales Tax paperwork. The figures I need for this report are Total...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.