A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Default Value



 
 
Thread Tools Display Modes
  #1  
Old December 17th, 2008, 10:29 PM posted to microsoft.public.access.gettingstarted
Dine Lene
external usenet poster
 
Posts: 1
Default Default Value

In the primary table, I have an "ApproveDate" field, the next field
(ReportDate), I want a default value to be 6 months from ApproveDate. What
is the expression for this?
--
Dine Lene
  #2  
Old December 17th, 2008, 11:06 PM posted to microsoft.public.access.gettingstarted
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default Default Value

Hi

Your would be best off deleting the Report Date from the table and just
create a query based on your table. You can have a calculted field in the
query to display your 6 months in advance date

SELECT DateAdd("m",6,[TableName]![ApprovedDate]) AS ReportDate,
FROM TableName;

--
Wayne
Manchester, England.



"Dine Lene" wrote:

In the primary table, I have an "ApproveDate" field, the next field
(ReportDate), I want a default value to be 6 months from ApproveDate. What
is the expression for this?
--
Dine Lene

  #3  
Old December 17th, 2008, 11:19 PM posted to microsoft.public.access.gettingstarted
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Default Value

Are you attempting to do that because you expect EVERY [ReportDate] to be 6
months after [ApproveDate], or is it possible that you'd have a [ReportDate]
that was NOT 6 months later?

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Dine Lene" wrote in message
...
In the primary table, I have an "ApproveDate" field, the next field
(ReportDate), I want a default value to be 6 months from ApproveDate.
What
is the expression for this?
--
Dine Lene



  #4  
Old December 18th, 2008, 04:04 PM posted to microsoft.public.access.gettingstarted
Ron2006
external usenet poster
 
Posts: 936
Default Default Value

Some thouths for 6 month's from now:

Whether you save it as a separate field or simply use the 6 month add
routine, don't forget that you will most probably need to ALWAYS do a
range search on the report date for your report.

Today is Thursday. But 6 months from now might NOT be a normal work
day or it might end up on a Holiday. What date will you get adding 6
months to Dec 31st? During a leap year? During a non-leap year?

Ron
  #5  
Old December 22nd, 2008, 05:02 PM posted to microsoft.public.access.gettingstarted
Armen Stein
external usenet poster
 
Posts: 507
Default Default Value

On Wed, 17 Dec 2008 13:29:01 -0800, Dine Lene
wrote:

In the primary table, I have an "ApproveDate" field, the next field
(ReportDate), I want a default value to be 6 months from ApproveDate. What
is the expression for this?


Looks like nobody has actually answered your question. You've
probably already figured it out, but I'll answer for posterity.

Since you used the word "default", I'm assuming that the ReportDate
isn't *always* 6 months later, in which case it would be true that you
shouldn't store it at all. But it's perfectly fine to store it if
it's just a default value that could change independently of the
ApproveDate.

In the form that edits the ApproveDate, but a bit of code in the
AfterUpdate event of the ApproveDate control:

'default ReportDate to 6 months after ApproveDate
Me.ReportDate = DateAdd("m", 6, Me.ApproveDate)

As Ron mentioned, this future date could end up falling on a weekend
or holiday, so if you're checking if it has arrived, make sure you
check for dates = Date(), not just =.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.