From the course: Access: VBA

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Close an object

Close an object

From the course: Access: VBA

Start my 1-month free trial

Close an object

- [Narrator] When a user finishes working with a database object, they can close it through the user interface. However, if you'd like to close an object programmatically, you can use the do command dot close method. I'll demonstrate how to do that in this movie. I am working in the course database, and I have the Close Objects form open, as well as the Customers table, Products report and Categories form. We'll work with all three of those other objects in a moment. The Close Objects form, has three command buttons on it and those are to close the form, close the report, and close a table. We'll start by closing the Categories form. To assign VBA code to a command button I need to be in Design View. So I'll go ahead and on the Home tab, click the View button's down arrow and click Design View. And then I will right click the Close Form button. At the top of the shortcut menu there's the Build Event menu item, so I'll click that. Then in the Choose Builder dialog box I'll click Code…

Contents