Thanks.
i did the same for OpenForm din't work.
did for Load it works..why so?
On-open is an event that can be used to cancel the form load. So, code that
tests for certain conditions can and should be placed in the on-open. IF the
form successfully opens..then the on-load event starts to run.
This means that on-open is TOO early to modify any controls. So, you have
this wonderful design split where your testing code, or condition code that
can prevent the form from opening goes into the on-open event.
So, you should as a habit place all your setup and initializing code in the
on-load (this includes setting up values of controls). And, if your code in
the on-open prevents the form from loading..then none of your nice setup
code for controls etc will run.
So, there is actually a distinct of use and purpose for each event.
on-open = check things..can set cancel = true to prevent form load.
(I used this event for record locking testing etc.). If
user can't get a record lock..then I don't
allow the form to be opened)
on-load = everything ok..lets now setup controls defaults, calendar stuff,
setup VB code variable values. etc....
So, general form setup code goes in this event....