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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Add Days from another table to Date in current table



 
 
Thread Tools Display Modes
  #1  
Old June 30th, 2009, 07:53 PM posted to microsoft.public.access
MrPaladin
external usenet poster
 
Posts: 2
Default Add Days from another table to Date in current table

I've tried searching for an answer and I see alot of reply:[Date]+number and
DateAdd("d",number,[Date]) but I cant seem to connect the dots to get the
number I want from another table.

I have two tables. Table1 is called Procedure and it contains a field
called ExpireDays which is a number (representing days). Table2 is called
Class and has a date field called ClassDate and another date feild called
ExpiresDate.

I want to use a form that will automatically calculate the ExpiresDate by
adding the number of days selected from a record in the Procedure table to
the ClassDate entered on the same form.

No matter what expression I have tried I get an error (or nothing at all
changes).

Any help is appreciated... Thankyou
  #3  
Old June 30th, 2009, 09:55 PM posted to microsoft.public.access
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Add Days from another table to Date in current table

You can do it as a batch using an update query. To have it happen as you do
data entery on a form you need a query that has both tables joined. Both of
the queries must have a common field such as ClassID. Use an On Update event
of the field ,[Class].[ClassDate] in your form.

SET Class.ExpiresDate = DateAdd("d",Procedure.ExpireDays
,[Class].[ClassDate])


"MrPaladin" wrote:

I've tried searching for an answer and I see alot of reply:[Date]+number and
DateAdd("d",number,[Date]) but I cant seem to connect the dots to get the
number I want from another table.

I have two tables. Table1 is called Procedure and it contains a field
called ExpireDays which is a number (representing days). Table2 is called
Class and has a date field called ClassDate and another date feild called
ExpiresDate.

I want to use a form that will automatically calculate the ExpiresDate by
adding the number of days selected from a record in the Procedure table to
the ClassDate entered on the same form.

No matter what expression I have tried I get an error (or nothing at all
changes).

Any help is appreciated... Thankyou

  #4  
Old June 30th, 2009, 11:41 PM posted to microsoft.public.access
Pieter Wijnen
external usenet poster
 
Posts: 1,354
Default Add Days from another table to Date in current table

Normally you would not need the class.expiredays as I see it if a
Procedure's expiry date can't change over time(?), because then you *should*
calculate it when you need it, using a query, a function (even Dlookup).

hth

pieter

"KARL DEWEY" skrev i melding
...
You can do it as a batch using an update query. To have it happen as you
do
data entery on a form you need a query that has both tables joined. Both
of
the queries must have a common field such as ClassID. Use an On Update
event
of the field ,[Class].[ClassDate] in your form.

SET Class.ExpiresDate = DateAdd("d",Procedure.ExpireDays
,[Class].[ClassDate])


"MrPaladin" wrote:

I've tried searching for an answer and I see alot of reply:[Date]+number
and
DateAdd("d",number,[Date]) but I cant seem to connect the dots to get the
number I want from another table.

I have two tables. Table1 is called Procedure and it contains a field
called ExpireDays which is a number (representing days). Table2 is
called
Class and has a date field called ClassDate and another date feild called
ExpiresDate.

I want to use a form that will automatically calculate the ExpiresDate by
adding the number of days selected from a record in the Procedure table
to
the ClassDate entered on the same form.

No matter what expression I have tried I get an error (or nothing at all
changes).

Any help is appreciated... Thankyou



  #5  
Old July 2nd, 2009, 04:01 PM posted to microsoft.public.access
MrPaladin
external usenet poster
 
Posts: 2
Default Add Days from another table to Date in current table

Thinking over it a bitthe original plan was to allow manager to change the
expiration as needed and not impact previous classes. But it would suit our
needs not to worry about that case and allow the expiration date to be
calc'ed in querie as you suggest.

I'll still add the expected expiration onto the form for ease.

Thank you all for the great responces.

"Pieter Wijnen" wrote:

Normally you would not need the class.expiredays as I see it if a
Procedure's expiry date can't change over time(?), because then you *should*
calculate it when you need it, using a query, a function (even Dlookup).

hth

pieter

"KARL DEWEY" skrev i melding
...
You can do it as a batch using an update query. To have it happen as you
do
data entery on a form you need a query that has both tables joined. Both
of
the queries must have a common field such as ClassID. Use an On Update
event
of the field ,[Class].[ClassDate] in your form.

SET Class.ExpiresDate = DateAdd("d",Procedure.ExpireDays
,[Class].[ClassDate])


"MrPaladin" wrote:

I've tried searching for an answer and I see alot of reply:[Date]+number
and
DateAdd("d",number,[Date]) but I cant seem to connect the dots to get the
number I want from another table.

I have two tables. Table1 is called Procedure and it contains a field
called ExpireDays which is a number (representing days). Table2 is
called
Class and has a date field called ClassDate and another date feild called
ExpiresDate.

I want to use a form that will automatically calculate the ExpiresDate by
adding the number of days selected from a record in the Procedure table
to
the ClassDate entered on the same form.

No matter what expression I have tried I get an error (or nothing at all
changes).

Any help is appreciated... Thankyou




 




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:47 AM.


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