Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update table from calculated combo box? 2

Status
Not open for further replies.

needlotsofhelp

Technical User
Apr 4, 2002
7
0
0
US
Dear Access Helpers,
I am a new user in need of help please!
I have a form based on a table called Training, on which I track training events accomplished and due.
I have a dateaccomplished combo and a datedue combo.
I am calculating the date due by putting =dateaccomplished+365 in the Control Source of the datedue combo box. My calculation is displaying the correct duedate on the form , but my duedate data is not being saved to the underlying table. The dateaccomplished does show up on the table. I need both to save to the table because I base reports of the table.
Will someone please help me? Any and all suggestions will be greatly appreciated!
 
The reason why it is not saving the data into the table is because dateDue is an "unbound" control – there is no way of the system knowing where ( or if ) you want the information stored.

DueDate RecordSource = datedue( table' field name)

Then in the DateComplete After_Update event write
Datedue = dateaccomplished+365

You can then, if you want to, edit the dueDate on the form to completely different date if the need arises and that too will be stored.

( Usual caveat: WHY are you storing this data if it is only dataAccomplished+365 ?
If you leave the form EXACTLY as it is then the user sees the necessary information; and any time you need dueDate in the future – you know how to calculate it – so calculate it.
General Rule NEVER store data that can be calculated from other data held in the database. )



G LS
 
Thanks so much for your help!! Would it be better to just add the the calculation to my report, instead of storing the data? I added the calc to a text box on my report & it worked. Your help is greatly appreciated!!!
 
General Rule: NEVER store data that can be calculated from other data held in the database.

That goes for where ever you intend to use it.
A report is, after all, just a form that is designed to aim at the printer rather than the screen ( & is primarily Read Only ).

Calculate calculated values when ever they are needed and calculate them where ever thay are needed.


G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top