Do you need to know how long you’ve spent on a project? You can create an Access form that will answer that question for you. Follow these steps:
- Click on the Form Object in the Database Window and click New. (In Access 2007, click the Create tab and then click Forms Design in the Forms group.)
- Click the Text Box control tool and then click and drag in the form where you want to locate the control.
- Click on the text box label and change the caption to Enter Project Start Date.
- Right-click the text box and select Properties.
- Click in the Name Property box and enter ProjectStart.
- Click the drop-down arrow of the Format property box and select ShortDate 6.
- Click the Text Box control tool and then click and drag in the form to create a second text box below the first one.
- Click the text box label and change the caption to Actual Work in Months, as shown in Figure A.
- Right-click the second text box and select Properties.
- Click in the ControlSource property box and under the Data tab, click the Build button.
- Type the following function code as shown in Figure B:
- Click OK.
- Close and save the form as Total Work Calculations.
When you run the form and enter a date in the ProjectDate text box, Access will automatically display the number of months from the entered date to today, as shown in Figure C.
Miss an Access tip?
Check out the Microsoft Access archive and catch up on other Access tips.
Help users increase productivity by automatically signing up for TechRepublic’s free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.