473,663 Members | 2,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Access adding dates

Hi,
Does anyone know how to make 1 date field 6 months ahead of another in
ms access?
Eg, I have a field called "startdate" where a date is entered. I want
"offprobationda t" equal to startdate + 3 months.
Thanks a lot.

*** Sent via Developersdex http://www.developersdex.com ***
Dec 26 '05 #1
5 3402
On Mon, 26 Dec 2005 02:45:09 GMT, jim Bob <fr****@gmail.c om> wrote:
Hi,
Does anyone know how to make 1 date field 6 months ahead of another in
ms access?
Eg, I have a field called "startdate" where a date is entered. I want
"offprobationd at" equal to startdate + 3 months.
Thanks a lot.

*** Sent via Developersdex http://www.developersdex.com ***


Sub StartDate_After Update()

If Not IsNull(Me.Start Date) Then
Me.OffProbation Date = DateAdd("m",3,M e.Startdate)
Else
Me.OffProbation Date = Null
End If

End Sub
Wayne Gillespie
Gosford NSW Australia
Dec 26 '05 #2


Hi Wayne,
Thanks a lot for the reply.
How do i USE this code?
Eg do i put it as a macro or module or paste the code into the table in
Design view?

Cheers
*** Sent via Developersdex http://www.developersdex.com ***
Dec 26 '05 #3
On Mon, 26 Dec 2005 04:55:07 GMT, jim Bob <fr****@gmail.c om> wrote:


Hi Wayne,
Thanks a lot for the reply.
How do i USE this code?
Eg do i put it as a macro or module or paste the code into the table in
Design view?

Cheers
*** Sent via Developersdex http://www.developersdex.com ***


You need to enter the data in a Form in order to make this work. Entering the data directly into a table will not
trigger the calculation.

Create a form which includes StartDate, OffProbationDat e and any other fields you require from your table. You can use
the Form Wizard to create this form if you want.

Once you have the form, open it in design view and click on the StartDate control and open it's properties sheet. (right
click - properties).

Click on the Event tab and select AfterUpdate. Click the (...) button which appears at the right of the property. Select
Event Procedure. The form's code module will open with the header and footer for the procedure auto created as such -

Sub StartDate_After Update()

End Sub

Paste the following code between the header and footer lines -

If Not IsNull(Me.Start Date) Then
Me.OffProbation Date = DateAdd("m",3,M e.Startdate)
Else
Me.OffProbation Date = Null
End If

Open the form in normal mode. When you enter a date in StartDate, OffProbationDat e will be set to 3 months ahead of the
StartDate. If StartDate is deleted OffProbationDat e will also be deleted.
Wayne Gillespie
Gosford NSW Australia
Dec 26 '05 #4

"jim Bob" <fr****@gmail.c om> wrote in message
news:VO******** ********@news.u swest.net...
Hi,
Does anyone know how to make 1 date field 6 months ahead of another in ms access?
Eg, I have a field called "startdate" where a date is entered. I want "offprobationda t" equal to startdate + 3 months.
Thanks a lot.

*** Sent via Developersdex http://www.developersdex.com ***


jib Bob,

UPDATE UnknownTable
SET offprobationdat = DateAdd("m", 3, startdate)
Sincerely,

Chris O.
Dec 26 '05 #5

Hi Guys,
Thanks a lot for your help!!
I've sorted it out via a form and an update query.

*** Sent via Developersdex http://www.developersdex.com ***
Dec 27 '05 #6

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

Similar topics

1
5387
by: Miguelito Bain | last post by:
hi everybody. i'm trying to find out what you can and can't do with/in calculated fields. any help, pointers, and/or advice would be greatly appreciated. i'm a newbie, but i want to learn, and i've tried a lot before posting. here's my situation. i have a simple form with dates on it. i have an indate and outdate
6
4739
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
9
1900
by: Neil | last post by:
I have been coding with ASP for some time now. I am using an ACCESS database. I am in the UK and wish to use DD/MM/YYYY format for dates. I have had no end of problems and possible solutions to dates such as 1/8/05 being interpreted in the wrong way. I have been given many suggestions (setting LCID, submitting dates in long format etc. etc.) Is there any definitive sloution or tutorial available? This is driving me
0
2716
by: neoteny2 | last post by:
I need MS Access to automatically create reports/subreports based on specific criteria. I am building a database in Access 2003 with different locations/sites. I have the "sites" table created containing site info, including an empty field for "date". I also have a report format already created displaying the site info. I need Access to ask the user for a date, calculate three additional dates using the entered date (adding or subtracting...
1
5156
by: Brad | last post by:
Thanks for taking the time to read my question. I have a table of data that has Date, Data and Category. I need to show, in a report, each Categories Data by Date. The Date has to be it's own column across the top and Category down the left side. As data is entered, the number of unique dates increases. As a result the
3
5515
by: rsbutterfly16 | last post by:
hi all, I have a front end access database (mdb) with a sql server backend for my tables. I have an form in which I have created a store procedure in sql server, and i have a form created and also a sql pass thru query. I am not sure yet of which is better for the parameters. can someone tell me the steps to do this? my form is in access, what i did was i created a sql pass through query that exec the procedure and it works fine but i...
5
2554
by: Henning M | last post by:
Hi all, I having some problems with Access and selecting records between dates.. When I try this in access, it works fine!! "Select * from Bilag Where Mdates Between #1/1/2006# And #31/1/2006#" But when I try it from my vb.net app, I get ALL the records in the tabel?? What goes wrong? I haven't been able to find any info on the net, besides others having
5
3161
by: Easystart | last post by:
Hi, Sorry for my English. English is not my native tougue. I am working in MS Access 2000 with a SQLServer 2000 Backend database. MS Access 2000 is my GUI front end that has SQLServer linked tables in it. One of my forms has two TEXT BOX controls formated as Short Date. The form is binded to a linked table. The linked tables has about 7 records and one of the control is binded to a table field. These two controls displays the date...
25
2260
by: DFS | last post by:
I have a job to automatically import Excel data and post to database tables, via a point-click interface. Choose-file-and-it-does-the-rest kind of thing. Cient stores data in columns in his sheet (I told them it should be in rows, but that's another issue). Sometimes the sheet gets new columns added. At that point, Access/import spec won't recognize the new columns. DoCmd.TransferText acImportDelim, "importSpec", "TABLE_NAME",...
14
2895
by: awayne | last post by:
I am working with MS VB 6.5. I am putting together a MS Access (MS Access 2000) database for work to keep track of the projects and their status that we've done. I use MS Access to run a "Make-table query" that sorts by Ascending date (date is (Field(5) for coding purposes) and then use the information in the table to create the table in a word document. The query also captures beginning and ending dates so people can create a report that covers...
0
8436
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
8858
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...
0
8771
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...
0
8634
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...
0
7371
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...
0
5657
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
4182
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...
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
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.