Software

Create an Access form that calculates how many months a project has been underway

Set up a simple form that can quickly tell you how long you've been working on a project. Mary Ann Richardson walks through the process.

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:

  1. 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.)
  2. Click the Text Box control tool and then click and drag in the form where you want to locate the control.
  3. Click on the text box label and change the caption to Enter Project Start Date.
  4. Right-click the text box and select Properties.
  5. Click in the Name Property box and enter ProjectStart.
  6. Click the drop-down arrow of the Format property box and select ShortDate 6.
  7. Click the Text Box control tool and then click and drag in the form to create a second text box below the first one.
  8. Click the text box label and change the caption to Actual Work in Months, as shown in Figure A.

Figure A

  1. Right-click the second text box and select Properties.
  2. Click in the ControlSource property box and under the Data tab, click the Build button.
  3. Type the following function code as shown in Figure B: =DateDiff("m",[ProjectStart],Now())

Figure B

  1. Click OK.
  2. 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.

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.

Editor's Picks

Free Newsletters, In your Inbox