How best to use Setvalue in later calculation

geoB

Registered User.
Local time
Today, 06:20
Joined
Oct 10, 2008
Messages
68
I've tried looking before asking, but my eyes are beginning to lose focus.

frmBabies has a control for birthdate. The birthdate is used to calculate the due dates for a set of follow-up tasks. These tasks appear on a subform that is one of several tabbed pages.

When I use a calendar control built into the form, I'm able to generate the due dates immediately. This means that right after clicking on the date, I can go to the follow-up page to see the schedule. So far, so good.

Because there are a number of dates required in the entire application, I've tried using Uncle Gizmo's calendar. But I'm hung up on how best to trigger the schedule calculation. I'm assuming this calendar uses Setvalue to change the control, so BeforeUpdate or AfterUpdate won't help. I have not yet stumbled on the right method that will calculate the schedule such that it is visible when I click on the follow-up page tab.

For example, I've thought of using the LostFocus event to trigger the calculations, but that's not effective because losing focus happens when the calendar form opens! Next up - maybe create an invisible unbound control on the form that acts as a flag indicating whether focus has just been to the calendar?

If this is comprehensible, your guidance will be most appreciated. If this isn't, I may be able to make it clearer - please ask.

Thanks immensely.

George
 
Last edited:
The solution: add to form a hidden control set to the existing date (which may be null) when form is opened. Use the calendar to set or change the date. LostFocus event procedure tests whether this date is different from hidden date. If different, perform calculations. Calculation results are not instantaneously visible - one still has to do something to cause focus to be lost. But it will have to do. gwb
 

Users who are viewing this thread

Back
Top Bottom