Incrementing Dates

  • Thread starter Thread starter Bernard Murphy
  • Start date Start date
B

Bernard Murphy

I have two fields - StartDate & EndDate.

Is there any way via a form by which I can insert the Start date and have
the EndDate field in the table
automatically updated??
I do apprerciate that the EndDate does automatically update on the form but
how to get it to transfer to the table??


Many thanks

Bernard
 
If the end date is calculable, you do not need to store it in the database.
Use a query to calculate it each time you need to display it and base your
form or report on the query instead of the table. If you can't calulate it,
you do need to store it in the table.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Thanks indeed....yes I do know how to calculate in a form and/or query.

Do I take it therefore that there is no way by which inputting calculated
data via a form can be transferred
to the original database table?

Many thanks for your reply.


Bernard
 
The issue isn't whether or not it's possible to store them (it is). The
issue is whether or not you should store them (you shouldn't).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)
 
Thanks I accept that although I am not clear as to why one shouldn't.
How is it possible then to store in the table via the form?

Thanks for all the assistance.


Bernard
 
As fellow Access MVP John Vinson likes to say "Storing calculated data
generally accomplishes only three things: it wastes disk space, it wastes
time (a disk fetch is much slower than almost any reasonable calculation),
and it risks data validity, since once it's stored in a table either the
Total or one of the fields that goes into the total may be changed, making
the value WRONG."

One approach for "how" is to have 2 fields on the form: one visible, and one
hidden. Bind the hidden field to the appropriate field in the form. In the
form's BeforeUpdate event, put code to transfer the value that's in the
visible field to the hidden field.
 
In addition to Doug's method, you can write a few lines of code that check
for the existence of the other elements of the calculation then fills the
the calculation in the bound text box.


If Not IsNull(Me.txtField1) Then
Me.txtField3 = Me.txtField2 * Me.txtField1
End If

Doug already told you why not to. Good database design is important for a
smoothly running application.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Thanks very much ......that explains the entire position very well.

Thanks again to all



Bernard
 
Back
Top