Hi,
Using Access 2010 on Win7 Pro box.
I have a form with a date field that has the 'Show Date Picker' property set to 'For dates'. That field also has the Set Focus property set on Form Open.
The form also has a Close button with code that closes said form and opens another based on how said form was opened; whether from another form (based on OpenArgs) or directly from the Switchboard.
The problem occurs if the user, once opening the form then decides to close it without entering any data, and therefore the focus not moving to any other control, clicks on the Close button. Because the focus is still set to the date field, clicking the Close button causes the calendar to appear in the date field and the code behind the Close button doesn't execute.
I've tried coding to shift the focus away from the date field when the Close button is clicked or in the Close button's other events: OnGotFocus, OnMouseMove, OnMouseDown and OnEnter. But nothing works to pull the focus away from the date field.
Obviously if the user enters any data into the form, the focus will be away from the date field and the Close button's code will function properly.
How can I solve this issue? Or do I have to set the focus on another field when opening the form? (Not my preference.)
Thanks,
Vic