Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Developer > D47 > D47 Lessons < D46 Lessons | D48 Lessons >
Access Developer 47 Lessons

Welcome to Access Developer 47. Total running time is 61 minutes.


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Buy Now

          Only $55.99
          Members pay as low as $28

Lessons

Database Files

Links

Resources

Questions?

Please feel free to post your questions or comments below. If you have questions about a specific lesson, please specify the lesson number and the time index in the lesson where the issue occurs. Thank you!

Subscribe for Updates

If you would like to be notified whenever changes are made to this page, new lessons are posted, or comments are made, click on the subscribe button.

 

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Access Developer 47 Lessons
Get notifications when this page is updated
 
Transcript Today we're going to learn about opening multiple instances of the same form. For example, you might want to open four customers at the same time. Or, if you're working on orders, you may want to open five different products so you can see all their information at the same time. We will be using the same form, copies, or instances of the same form.

To do this, we'll learn how to create our own collections, which is an object type in Access. We'll learn how to track the individual forms with a key value so we can tell which one is which. We'll learn how to cascade them when they open so they open layered. All kinds of cool stuff like this in today's class.

Today's class follows Access Developer 46. It's not a hard prerequisite, but I do cover a lot of topics that I've covered in previous developer courses. As always, my classes are designed to be followed one after the other, so I recommend you start at Beginner Level 1 and work your way all the way up. Lots of developer-level VBA material is covered today. That's why I generally advise against skipping levels.

It is currently December 2024. The closest retail version of Access to this one is going to be Access 2024. I'm currently using an Access 365 subscription, which is what I recommend. That way, you always have the latest and greatest version and you don't have to worry about upgrading. The material covered in today's class, however, should apply to at least Access 2007, maybe earlier, but that's probably the earliest version I would say it would work with.

If you have questions regarding the material covered in today's class, just scroll down to the bottom of the page that you're watching the lessons on and you can post your questions there. Also, take a minute to read through any other questions that may have been posted, as your question may have already been answered. Make sure you subscribe to this page to get notified of any other questions or comments posted for this class.

Also, make sure to visit my Access forum where you can post questions about anything else related to Access. You can join in conversations with me, the moderators, and other Access students.

Now let's take a closer look at exactly what's covered in Access Developer 47.

In lesson one, we're going to learn how to create multiple instances of the same form. For example, on your customer list form, you can open up multiple copies of the customer form with different customers in each. Or, you can open up multiple products or multiple orders or multiple whatever you want. We'll learn about collections, how to create collections, and how to add objects to a collection.

In lesson two, we're continuing with multiple form instances. I'm going to show you how to list all of the open forms. We'll make sure the collection is initialized to avoid errors. We'll deal with closed forms, and I'll show you how to track forms with a key value. We're going to make our own key value; we're not going to use the built-in one. It's better.

In lesson three, I'm going to show you how to not open the same customer form twice, which could cause write errors. For example, if you open up Richard Rost twice, edit one, then edit the second one, it could cause issues, so we'll prevent that. Then we'll see how to give a specific form focus, so if you want to loop through the forms and find a specific one, you can. I'll show you how to cascade the forms when you open them, so if you open four in a row, they cascade nicely, just like pretty little windows should.

In lesson four, we're going to finish up working with collections and multiple form instances. We're going to start by killing the collection and resetting it if we detect that the user has closed all the forms. We want to keep our memory nice and tight.

Then we're going to take all our code and drop it into ChatGPT to see what it has to think about it. Maybe it can make some suggestions, things to do better, or things I might have missed. We'll see what that's all about in just a minute.
Quiz LESSON 1:

Q1. What command should NOT be used to create multiple instances of the same form?
A. DoCmd.OpenForm
B. Form.Visible = True
C. Set F = New Form
D. DoCmd.Close

Q2. What is the scope of a variable declared inside a subroutine?
A. Global-level scope
B. Procedural-level scope
C. Module-level scope
D. Form-level scope

Q3. How can you ensure that multiple instances of the same form can be opened simultaneously?
A. Use a different form variable for each instance
B. Use a global variable for all instances
C. Use a collection to store form objects
D. Set the form's Visible property to False

Q4. What does setting a variable to Nothing accomplish?
A. It assigns a global value to the variable
B. It saves the current value of the object to the database
C. It releases the memory allocated to the object
D. It makes the form visible on the screen

Q5. When do you need to set an object variable after declaring it?
A. Before exiting the module
B. After using the object in a procedure
C. Immediately after declaring the variable
D. Only when the object variable is public

Q6. What must be done to prevent all form instances from closing when the main form closes?
A. Use a module-level scope for the collection
B. Use a form's Unload event to close forms
C. Declare the collection as Public in a global module
D. Set the form instances to Read-Only

Q7. Why is it necessary to initialize the OpenForms collection in the form load event?
A. To ensure compatibility with the main menu
B. To prevent runtime errors in the application
C. To guarantee that the collection variable has been set before use
D. To automatically close forms when the form loads

Q8. What application behavior should be considered when using public variables in a developer environment?
A. They can simplify code readability in subroutines
B. They enhance security by restricting access to forms
C. Compile or runtime errors can erase public variables
D. They automatically destroy after each form use

Answers: 1-A; 2-B; 3-C; 4-C; 5-C; 6-C; 7-C; 8-C

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.

----

LESSON 2:

Q1. What is the purpose of listing all open forms in the tutorial?
A. To count the total memory usage
B. To help debug the application efficiently
C. To manage multiple instances and track them effectively
D. To close all forms simultaneously

Q2. How do you initialize the collection for open forms to avoid errors?
A. Set the collection to null upon form load
B. Use a check collection subroutine in the form load event
C. Assign the forms directly to an array
D. Restart the application

Q3. Which loop is preferred in the tutorial for listing forms and why?
A. For Each loop; because it is easier to write
B. While loop; because it automatically handles errors
C. Itemized counter loop; because it provides index-based access
D. Do Until loop; because it reduces complexity

Q4. What happens when errors occur in VBA regarding form collection?
A. The error is automatically fixed and proceeds
B. All public variables including the collection are cleared
C. The application crashes and restarts automatically
D. The forms automatically close to prevent errors

Q5. Why does the tutorial advise against using built-in keys for identifying forms?
A. Keys are not supported in the VBA environment
B. Built-in keys are unreliable and difficult to manage
C. They don't offer uniqueness among different forms
D. Built-in keys consume too much memory

Q6. How is a custom key recommended to be stored in the tutorial for identifying forms?
A. In a temporary variable
B. In the form tag property
C. In an unbound textbox on the form
D. In a separate database table

Q7. What problem might arise if the same customer form is opened twice according to the tutorial?
A. The database duplicates the customer data
B. The application crashes due to multiple instances
C. You may encounter write conflicts when saving changes
D. The forms overwrite each other's visual settings

Q8. What ensures that the open forms collection is available when the form loads?
A. Adding a new form event to trigger during form load
B. Manually entering form details in a global array
C. Checking if the open forms collection is null and initializing it
D. Persistently storing form data externally

Q9. What does the tutorial suggest doing in case of errors to maintain the functionality of the form collection?
A. Throwing all errors and restarting the application
B. Implementing error handling to manage error responses
C. Logging errors and manually fixing them post-runtime
D. Disabling error throwing in the form collection module

Answers: 1-C; 2-B; 3-C; 4-B; 5-B; 6-C; 7-C; 8-C; 9-B

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.

----

LESSON 3:

Q1. What is the primary purpose of resetting the collection when all forms are closed in the lesson?
A. To save changes made to the open forms
B. To enhance the user interface design of the application
C. To keep memory usage efficient and release unused resources
D. To improve the application's loading speed

Q2. Which method is suggested for checking if a form in the collection is open or closed?
A. Access a random property of the form
B. Use a built-in function to check form status
C. Use a property from the form that displays a status message
D. Check if the form can be minimized

Q3. What type of loop is suggested for traversing the forms in the open forms collection?
A. For each loop to specifically manage the form count
B. Counter-based loop for ease of exiting when conditions are met
C. Recursive loop to manage nested collections
D. Infinite loop to ensure all forms are processed

Q4. How does the lesson suggest handling errors when checking if a form is open?
A. Log the error and skip the form
B. Change the form's properties to indicate it's closed
C. Use "On Error" to redirect to a specific part of the code for closed forms
D. Restart the check with a new form collection

Q5. What is the instructor's opinion on Microsoft's documentation about keys in the context of collections?
A. It provides an excellent resource for all developers
B. It is often incomplete and not very useful
C. It is comprehensive but hard to understand
D. It is outdated and needs an update

Q6. What does the instructor do with their lesson content to seek improvement suggestions?
A. Shares it on online forums for public feedback
B. Sends it to other developers in the field
C. Uploads it to chat GPT for analysis and feedback
D. Publishes it in a programming magazine

Q7. What is one suggestion given by the analysis for optimizing the collection reset?
A. Always clear the entire collection without checks
B. Preserve all valid forms and only remove closed ones
C. Use system default methods for resetting the collection
D. Avoid unnecessary checks to increase speed

Q8. What is the purpose of using a Boolean flag in the open forms checking loop?
A. To monitor the number of open forms
B. To indicate if at least one form is found open
C. To track if the loop starts correctly
D. To signal when to restart the collection analysis

Q9. What alternative method is mentioned for managing form properties instead of visibly tracking them?
A. Utilizing the title property of the form
B. Utilizing the tag property of the form
C. Using the form's tooltip property
D. Applying the border color property

Q10. Why does the instructor mention they prefer Google Docs over Word during certain phases?
A. Google Docs is the industry standard for document preparation
B. Google Docs allows easier online access and collaboration
C. Word processing capabilities in Google Docs are superior
D. Google Docs provides better offline storage

Answers: 1-C; 2-A; 3-B; 4-C; 5-B; 6-C; 7-B; 8-B; 9-B; 10-B

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.

----

LESSON 4:

Q1. What is the purpose of checking the collection before creating a new form?
A. To verify if a specific customer ID is available for creation
B. To ensure the collection has enough memory for new forms
C. To check if the form is already open and avoid creating duplicates
D. To log which forms are open for debugging purposes

Q2. Why is 'On Error Resume Next' used in the code?
A. To stop the program from running after an error
B. To continue executing the code even after errors occur
C. To manually handle specific errors with a custom message
D. To alert the user about possible syntax errors

Q3. What does the statement 'F.setfocus' accomplish in the code?
A. Closes the form if it is already open
B. Changes the form's layout to focus mode
C. Sets the input focus to an already open form
D. Highlights a specific section of the form

Q4. How can you restart the collection of open forms?
A. By clicking a "Refresh" button
B. By setting 'OpenForms' to an empty array
C. By setting 'OpenForms' to nothing
D. By restarting the application

Q5. Why is repositioning code added after making the form visible in 'open forms.add'?
A. To ensure that forms appear in predefined positions
B. To maximize form size before repositioning
C. To prevent the form from closing accidentally
D. To load specific content in the form based on position

Q6. Which language does not use short-circuit evaluation that can optimize condition checks?
A. Python
B. Java
C. VBA
D. C++

Q7. What is a possible issue caused by not turning off error handling after use?
A. Errors remain unhandled, causing program crashes
B. The program exits successfully with a log
C. Prevents multiple forms from opening simultaneously
D. Future code errors are ignored, leading to unresolved issues

Q8. Why might you want to clear and reset the collection in an application running all day?
A. To add new, unopened forms easily
B. To reduce the size and memory usage of the application
C. To make debugging easier and more efficient
D. To ensure all forms open at the same location

Answers: 1-C; 2-B; 3-C; 4-C; 5-A; 6-C; 7-D; 8-B.

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
Summary Today's video from Access Learning Zone is all about working with multiple instances of the same form in Microsoft Access. There are situations in Access where it can be really useful to have several copies of the same form open at the same time. For example, you might want to view information on four different customers simultaneously, or compare five separate products side by side. This approach allows you to work more efficiently with your data by keeping the details you need right in front of you, each in its own independent window.

To accomplish this, I'll guide you through the process of creating your own collections in VBA. Collections are object types that let you track multiple form instances. You'll learn how to manage these collections using a key value for each form, so you can easily tell which form is displaying which record. This method also allows you to perform actions like cascading the forms as they open, so they appear offset rather than stacked directly on top of each other. These skills are especially helpful when working with multiple records of the same table, such as different orders, products, or customers.

This class builds directly on topics covered in Access Developer 46. While it is not a strict prerequisite, much of the background material comes from earlier developer-level courses. My suggestion is to work through my courses in order, beginning with Beginner Level 1 and progressing upward, as I introduce important VBA concepts throughout the series.

At the time of recording, it's December 2024, and I'm working with Access 365, which I strongly recommend since it always gives you the latest updates and features. However, the techniques I present today should work with any version of Access going back to 2007, though I cannot guarantee compatibility with versions older than that.

If you have questions about the topics discussed in this lesson, you can post them at the bottom of the lesson page. I encourage you to browse through existing questions and answers, since someone else may have already addressed your question. Consider subscribing to the class page to receive notifications when new comments or answers are posted.

For questions beyond this lesson, remember there is an Access forum on my website where you can join discussions with me, the site moderators, and other Access users. It's a great place to ask for help or share your experiences.

Let me break down what we'll be covering in Access Developer 47.

In the first lesson, I'll introduce the technique for creating multiple instances of the same form. For instance, on your customer list form, you'll be able to open several copies of the customer form, each loaded with a different customer. The same method applies to other tables like products or orders. We'll cover how to use collections to keep track of each open form and how to add those form objects to your custom collection.

Lesson two goes deeper into managing multiple form instances. We'll go through listing every open form, ensuring your collection is properly initialized to prevent errors, and handling situations when forms are closed. You'll also learn how to assign and use your own key value for each form instance, rather than relying on the built-in key. This offers greater control and flexibility.

Lesson three focuses on preventing the same record from being opened in multiple form instances simultaneously, which could lead to data conflicts. For example, if you accidentally open the same customer in two forms and edit both, it can cause issues when saving. I'll show you how to avoid this problem. Additionally, you'll see how to programmatically give focus to a particular open form, and how to position each new form so that when several are opened in a row, they cascade across the screen instead of stacking on top of each other.

In the fourth lesson, we'll wrap up by looking at housekeeping tasks. You will learn how to reset and clear your collection if all the forms are closed, which helps keep your database running smoothly and avoids wasting memory.

Finally, we'll take all the code we've written, paste it into ChatGPT, and see what suggestions or improvements it might offer. This is a chance to get some feedback and maybe even spot a detail we've missed.

You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends.
Topic List Creating multiple instances of the same form in Access
Opening multiple customer, product, or order forms simultaneously
Creating and working with custom collections in VBA
Adding objects to a VBA collection
Listing all open form instances
Initializing collections to prevent errors
Handling closed forms in collections
Tracking individual form instances with custom key values
Preventing duplicate form instances for the same record
Giving focus to a specific form instance
Cascading multiple open forms for better window arrangement
Resetting and clearing collections when all forms are closed
Reviewing VBA code with ChatGPT for optimization suggestions
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 12/14/2025 3:28:01 AM. PLT: 2s
Keywords: access developer 47 lessons  PermaLink  How To Open Multiple Form Instances Track With Collections Cascade Layered Windows in Microsoft Access