ACC: Form Controls to Increment and Decrement a DateID: Q103194
|
Moderate: Requires basic macro, coding, and interoperability skills.
This article describes how to create form controls that increment or
decrement a date. After a date control is initialized to the date stored
in the computer, command buttons are used to increment or decrement the
displayed date.
The following example demonstrates how to create controls on a form that
can be used to increment or decrement the displayed date:
Object: Text Box
----------------------
Name: Call Date
Format: General Date
Default Value: =Date()
Locked: Yes
SpecialEffect: Sunken
Object: Command Buttons
-----------------------
Name: Decrease
Caption: <
AutoRepeat: Yes
OnClick: Change Date
Name: Advance
Caption: >
AutoRepeat: Yes
OnClick: Change Date
Macro Name Condition Action
----------------------------------------------------------------
Change Date Screen.ActiveControl.ControlName="Advance" SetValue
... GoToControl
... GoToControl
Screen.ActiveControl.ControlName="Decrease" SetValue
... GoToControl
... GoToControl
Change Date Actions
--------------------------------------------------
SetValue
Item: Forms![Date Selector]![Call Date]
Expression: Forms![Date Selector]![Call Date]+1
GoToControl
Control Name: [Call Date]
GoToControl
Control Name: [Advance]
SetValue
Item: Forms![Date Selector]![Call Date]
Expression: Forms![Date Selector]![Call Date]-1
GoToControl
Control Name: [Call Date]
GoToControl
Control Name: [Decrease]
For more information about the Screen.ActiveControl property, search the Help Index for "ActiveControl," or ask the Microsoft Access 97 Office Assistant.
Additional query words: date/time
Keywords : kbusage FmsEvnt
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 26, 1999