Solved

Subform Recordsource

Posted on 2004-08-25
4
1,188 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 100 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 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 50 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 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