Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / January 2004

Tip: Looking for answers? Try searching our database.

Default Value of field, from info in another field?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
E. J. - 15 Jan 2004 20:10 GMT
 I'm trying to create a field that will automatically
update a "Date", as the result of adding three years to
the date in the first field. Can an expression be written
directly in the "Default Value" property, Or, should I
write a query, then call that from "Default Value"? If the
latter, what would the expression be to make the call?

 Thank you.
Steve Schapel - 15 Jan 2004 20:45 GMT
E.J.,

The Default Value is not applicable in this case.  Default Value
refers to the point when a new record is started, and by the time you
have entered the value in your "First" field, it is too late for the
default value of the "Date" field to be applied.  It would be possible
to assign the value of the "Date" field on the After Update event of
the "First" field's control on your form, using a macro or VBA
procedure, e.g.
Me.YourDateField = DateAdd("yyyy",3,Me.YourFirstField)
But before you go down that track, I would expect that what you are
trying to do here is really an invalid purpose.  If the value of the
"Date" field will always be 3 years later than the value in the
"First" field, it should not be stored in the database anyway.  This
flouts one of the principles of database design.  Whenever you need
this date for your purposes on form or report, it should be derived at
the time via a calculated field in a query, or via an expression
within the control source of a textbox on the form or report itself.

- Steve Schapel, Microsoft Access MVP

>  I'm trying to create a field that will automatically
>update a "Date", as the result of adding three years to
[quoted text clipped - 4 lines]
>
>  Thank you.
E. J. - 15 Jan 2004 21:49 GMT
>-----Original Message-----
>E.J.,
[quoted text clipped - 29 lines]
>.
>    "Whenever you need this date for your purposes on
form or report, it should be derived at the time via a
calculated field in a query..."

 Thanks, Steve. I'm going to change the timing of this
data retrieval, as you suggested.

  Appreciate your help,
  E. J.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.