Assign values to Access records automatically
Takeaway: Use macros in Access to give your data a life of its own, complete with its own values and record assignments. Mary Ann Richardson explains how to add identity to your Access records.
You can save data entry time by creating macros that will automatically assign values entered in one Access form to create a new record in another form. For example, after creating a record for a new employee in the Employee Data table, suppose you need to create a new record for the employee in the Dependents table. Follow these steps:
- Open the Employees database.
- In the database window, click Macro under Objects.
- Click New.
- Click in the first action cell and enter OpenForm.
- Under Action Arguments, click in the Form Name box and enter Employee Data Form.
- Click in the Data Mode box and select Add from the drop-down list.
- Click in the next Action cell and select SetValue.
- Under Action Arguments, click in the Item box and enter [Forms]![Dependents]![EmployeeID].
- Click in the Expression box and enter [Forms]![Employee Data]![EmployeeID].
- Close and Save the macro as AssignValue.
- Open the Employee Data form in Design View.
- Right-click the form and select Properties.
- In the Event tab, click in the AfterUpdate property box, and select AssignValue.
This macro will create and display the new record with the common information. You can add additional SetValue actions to fill in other fields in the new record. For example, you might want to create a SetValue action to add the Employee's first and last name to the Dependents record.
Miss a tip?
Check out the Microsoft Access archive, and catch up on our most recent 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.
White Papers, Webcasts, and Downloads
- Building the Virtualized Enterprise with VMware Iinfrastructure VMware VMware virtualization software has been adopted by over 120,000 enterprise ... Download Now
- The Impact of Virtualization Software on Operating Environments VMware Today's use of virtualization technology allows IT professionals to ... Download Now
- The True Costs of Virtual Server Solutions VMware Discover ways to streamline and simplify your assessment of the total acquisition costs of a server virtualization environment. Download Now
- Email Security and Archiving - Clearer in the Cloud Google The time is NOW for businesses and organizations of all sizes to implement ... Download Now
- Building the Virtualized Enterprise with VMware Infrastructure VMware This paper explains how adopting a virtual infrastructure -- comprised of server, storage, and networking virtualization technologies -- can help your organization build a sustainable competitive ... Download Now
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET

