By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,425 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

Pass a calculated date value back into a table

100+
P: 139
Hi,

I can calculate the difference between two dates and display on a form in a text box as per MS Access help:

=DateDiff("d",[strDateRequested],[strDeliveryDate])

which shows the value. But how do I pass that value back into the table that my form is based on - in this case a field called strDayRemaining? I then need to use this value so I can run a query on records with only a few days remaining.

Thanks!
Neil
Dec 13 '07 #1
Share this Question
Share on Google+
8 Replies


Rabbit
Expert Mod 10K+
P: 12,396
The norm is to not store it in the table but calculate it when needed.
Dec 13 '07 #2

Jim Doherty
Expert 100+
P: 897
Hi,

I can calculate the difference between two dates and display on a form in a text box as per MS Access help:

=DateDiff("d",[strDateRequested],[strDeliveryDate])

which shows the value. But how do I pass that value back into the table that my form is based on - in this case a field called strDayRemaining? I then need to use this value so I can run a query on records with only a few days remaining.

Thanks!
Neil
Create a 'query' and base your form on the query. You can create a column in your query that holds that calculation for you as a field in itself.

Jim :)
Dec 13 '07 #3

Nathan H
100+
P: 104
Create a 'query' and base your form on the query. You can create a column in your query that holds that calculation for you as a field in itself.

Jim :)

Wow, is everyone doing the same job today? Everyone wants to post calc in a table today! :)
Dec 13 '07 #4

100+
P: 139
Having read other replies to storing calculated fields in a table I think it is best not to do it....so if i write a new query based on that table, do I just create a holding field to calculate that value when I need it, and run my report based on this query?

Thanks
Neil
Dec 14 '07 #5

Rabbit
Expert Mod 10K+
P: 12,396
Yes, that's correct.
Dec 14 '07 #6

missinglinq
Expert 2.5K+
P: 3,532
In the Query Grid, in a blank field, enter:

Expand|Select|Wrap|Line Numbers
  1. DaysRemaining: DateDiff("d",[strDateRequested],[strDeliveryDate])
  2.  
Welcome to TheScripts!

Linq ;0)>
Dec 14 '07 #7

100+
P: 139
That's great. Thanks for all your help!

Neil
Dec 17 '07 #8

Rabbit
Expert Mod 10K+
P: 12,396
Not a problem, good luck.
Dec 17 '07 #9

Post your reply

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