473,480 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Access 2003: Setting up an automatic end date

5 New Member
Hi, I'm very new to Access...my company decided we need to have a database and I'm somehow trying to get my arms around this...

I'm using a 2003 version of Microsoft Access running on Windows Vista. I would like to know how I can set up an automatic end date. I'll explain:

I have a 'task' table which, among others, includes two fields: Active and End Date. The "Active" field is a simple Yes/No data type; when I check off the Active box, the task disappear from a related 'task' form. I would like Access to generate automatically an End Date every time I check off an Active box. Obviosuly, the end date should be current day/month/year and should appear in the "End Date" field.

How can I do this?

I've browsed the website looking for similar posts, but haven't found any. If I've missed it, it would be great if you could point me to that.

Many thanks for your help!
Mattia
Oct 31 '08 #1
5 2738
nico5038
3,080 Recognized Expert Specialist
I would change the Active Yes/No into a Start date, this will enable the calculation of the duration of a task in the future.

For both dates I would use a [<Now] button to put the current date into the field.
Just put in the OnClick event of the button:
Expand|Select|Wrap|Line Numbers
  1. Me.[End Date] = Date()
  2.  
Nic;o)
Oct 31 '08 #2
PianoMan64
374 Recognized Expert Contributor
Hi, I'm very new to Access...my company decided we need to have a database and I'm somehow trying to get my arms around this...

I'm using a 2003 version of Microsoft Access running on Windows Vista. I would like to know how I can set up an automatic end date. I'll explain:

I have a 'task' table which, among others, includes two fields: Active and End Date. The "Active" field is a simple Yes/No data type; when I check off the Active box, the task disappear from a related 'task' form. I would like Access to generate automatically an End Date every time I check off an Active box. Obviosuly, the end date should be current day/month/year and should appear in the "End Date" field.

How can I do this?

I've browsed the website looking for similar posts, but haven't found any. If I've missed it, it would be great if you could point me to that.

Many thanks for your help!
Mattia
Mattia,

Simply put, you'd have to set the value for the field EndDate when the value of Active is set to true.

I'm assuming first of all that you have this table displayed in a form, and you're not updating the table directly in the table view?

I'm also assuming that if you are updating the information, that you're using a continuous form, or a form that has the "Active" field in it, and may or may not have the "EndDate" field on that form.

If either of those are true then here's what you need to do:

1. Go into design mode of the form
2. right-click on the CheckBox and select Properties.
3. Locate the "On Change" Event from the list of the available events
3. Then click on the ... button that is on the far right of Properties window, and select Code Builder.
4. You will then see a empty subroutine for "Active_OnChange" Event.
5. In the middle of that copy and paste the following code:
Expand|Select|Wrap|Line Numbers
  1.  
  2.           If me.active = True Then
  3.                me.EndDate = Date
  4.           Else
  5.                me.EndDate = Null
  6.           End If
  7.  
  8.  
Oct 31 '08 #3
mattia
5 New Member
PianoMan64,

Thanks, your answer is very clear. However, I'm such a begineer and I have a question: in the "Event" tab of the properties I have various "on change" items:
On Data Change, on Data Set Change, On PivotTable Change, On Selection Change, on View Change...which one is the one you are referring to?

Also, just to make sure we are on the same page, once I implement the new code, where will the End Date appear? On the Table? Not on the Form, since when the task is completed (i.e.: the Active box is checked off) the task disappear from the Form...

Many thanks!
Mattia
Oct 31 '08 #4
PianoMan64
374 Recognized Expert Contributor
PianoMan64,

Thanks, your answer is very clear. However, I'm such a begineer and I have a question: in the "Event" tab of the properties I have various "on change" items:
On Data Change, on Data Set Change, On PivotTable Change, On Selection Change, on View Change...which one is the one you are referring to?

Also, just to make sure we are on the same page, once I implement the new code, where will the End Date appear? On the Table? Not on the Form, since when the task is completed (i.e.: the Active box is checked off) the task disappear from the Form...

Many thanks!
Mattia
Hey Mattia,

The reason that you have all those choices is because when you right-clicked, you right-clicked on the form and not the check box control. If you will right-click on the check box control instead of some place on the form, then you will see the only change option that I'm speaking of.

That should clear up any confusion that you're having on the form.

You'll also notice that in the upper-left hand corner of the properties window, you'll see the name's of the controls that are on the current form, and well as other control names like (FORM, DETAIL) and maybe, FORMHEADER, FORMFOOTER, PAGEHEADERSECTION, PAGEFOOTERSECTION). These are for controls that are on the form that have events associated with them as well.

Since we're dealing with only the check box control, you need to make sure that when you right-click, that it is on the check box itself or use the pull-down menu in the properties window to select the name of the check box control.

I hope that helps,

Joe P.
Nov 1 '08 #5
mattia
5 New Member
Thanks! I'll try this out!

M
Nov 4 '08 #6

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

Similar topics

3
5682
by: Ian | last post by:
The beginning of my assembly that I am getting the access error from looks like this. ********************************* Imports System.EnterpriseServices Imports System Imports...
6
4706
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...
64
5135
by: John | last post by:
Hi What future does access have after the release of vs 2005/sql 2005? MS doesn't seem to have done anything major with access lately and presumably hoping that everyone migrates to vs/sql. ...
4
3569
by: TrinityPete | last post by:
Hi all, We have a web application that uses web services for data access and retrieval. The web app and web services reside under IIS on the same server(WIN2003). The virtual directories have...
52
9911
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
5
3136
by: Amogh | last post by:
Hi, My question is related to setting freed pointers to NULL. After freeing a pointer: 1) Should the freeing routine also be responsible for setting the pointer to null? 2) Or, should the...
3
3839
by: Sheldon | last post by:
I have the following query expression - Like Format((!!)) & "/*/" & (! !) which would translate to e.g. 04/*/2007 if someone is running a report for last month. The above expression is part of a...
9
4473
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
2
2904
by: | last post by:
Hi all, I have an asp.net 2.0 website that accesses a locally hosted web service. This works fine on servers that are connected to our network. However, I am having a problem with a laptop...
0
7055
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,...
0
6920
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...
0
7110
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...
1
6763
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...
0
4503
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...
0
3015
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...
0
3011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1313
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 ...
1
574
muto222
php
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.