![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello. I'm using Access 2007 on a WinXP system. I'm stymied on how to get a calculation to work properly. I'm a book review editor, and I'm keeping track of books I've sent out for review, etc. One field is titled "Date Book Received." I want to create a column in the table titled "Date Review Due" which takes the value in "Date Book Received" and adds 30 days to that date. I also want to have a column titled "Days Out" that takes today's date and subtracts the value in "Date Book Received." Do I create this formula in the "Default Value" area? Using the expression builder, I can't find a way of inserting field names. Any help will be greatly appreciated. |
#3
| |||
| |||
|
|
Jeffrey Needle wrote: Hello. I'm using Access 2007 on a WinXP system. I'm stymied on how to get a calculation to work properly. I'm a book review editor, and I'm keeping track of books I've sent out for review, etc. One field is titled "Date Book Received." I want to create a column in the table titled "Date Review Due" which takes the value in "Date Book Received" and adds 30 days to that date. I also want to have a column titled "Days Out" that takes today's date and subtracts the value in "Date Book Received." Do I create this formula in the "Default Value" area? Using the expression builder, I can't find a way of inserting field names. Any help will be greatly appreciated. Days Reviewed Example In the control source of the textbox for the review day due in the property sheet enter =dateadd("d",30,Forms!YourFormName!YourBookReceive dTextboxName) Substitute the "Your..." name with the real value Days Out example Public Function DaysOut() As Variant Dim datRecvd as date 'substitute the "Your" values with the form and field names datRecvd = Forms!YourFormName!YourReceivedFieldName DaysOut = DateDiff("d",datRecvd,Date) End Function Then in your text box for your form's ControlSource property sheet/data tab enter =DaysOut() and that will calculate the days out value. I demo'd 2 examples. One uses a formula in the control source, the other calls a function. |
![]() |
| Thread Tools | |
| Display Modes | |
| |