Consider enrolling in one of our virtual, full-day Access training classes. All classes are instructor-led, encourage interaction and questions, and provide hands-on exercises and learning aids. A frequent question asked in our Access classes concerns how to display the data in a form when the data is coming from more than one table. For instance, how can a form show each customer along with the many orders placed by each customer?
The solution is to create a subform in a form. The Customer table and Order table are already created for you, so you can focus on creating the subform. You must establish the relationship between the two tables. This relationship is a one to many, because each customer can place many orders, but each order is associated with only one customer. Highlight the Customers table, and click the Form button in the Forms group on the Create tab.
Access will assume the Customer table fields should be placed in the new form because it is selected. The Form button will add the subform for us. When you use the Form property in this manner, you are referring to the active form, and the name of the form isn't necessary. When you use the Forms collection, you must specify the name of the form. The following example uses the Form property to refer to a control on a subform.
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback. Skip to main content. This browser is no longer supported.
I'm not entirely sure what happened but I'll try to explain in case this happens to anyone else:. It is important to note that my report is based on a query, so when I placed it into my form drag and drop , it should have prompted me for certain values I called for in that query's SQL code which referenced other data elements in various forms , but it did not since I was in design view.
When I switched to layout view and placed my subreport in, it prompted me for those values, which initialized what records are initially displayed in the form. After having all my records pre-initialized in the form, the Requery code worked. Sorry if this doesn't make sense. I'm not sure why Access would be like this or why this didn't work through design view, but this is what worked for me.
How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How do I refresh the contents of a subform in Microsoft Access? Ask Question. Asked 4 months ago. Active 4 months ago. Viewed times. Requery I've also tried this, but it does the same thing: Me.
Let me know if I need to clear anything up.
0コメント