Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Subform Recordsource

Posted on 2004-08-25
4
Medium Priority
?
1,216 Views
Last Modified: 2011-10-03
I use MS Access 2000.

I have an unbound main form and then bound subforms.

How do you programmatically change the Recordsource of a subform?

For Example:  When the user is doing data entry and the main form opens, the form (and subforms) auto populate with a new entry.  This part works great, but with this I am setting the subform's Recordsource the easy way - using the Properties GUI of the subform.  

I want to remove this property in the Properties GUI and set the subform's Recordsource in VB.

I'm thinking that either in the "On Open" or "On Current" Event I need to have code something like:

form.recordsource "qry1"

But that didn't work.

Thanks.

-Bschreiber
0
Comment
Question by:Bschreiber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 7

Assisted Solution

by:SQL_Stu
SQL_Stu earned 400 total points
ID: 11891950
You need to refer to the subform correctly first!!!

In access, you need to use:

MainForm!SubForm.Form.Recordsource

to refer to the recordsource of the subform.

You will need to point the recordsource to a valid data source before you do this.

Please post more information if you need more help.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 200 total points
ID: 11892467
The correct syntax is:

MainForm.NameOfSubFormCONTROL.Form.Recordsource

What trips most people up is the NameOfSubFormCONTROL ... this is almost always NOT the name of the form contained within the subform, it's the name of the CONTROL on the main form.
0
 

Author Comment

by:Bschreiber
ID: 12813670
Thanks, & sorry it took me so long to clean this up.  Project abandoned and I haven't been in E-E in a while.

-BSchreiber
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question