Solved

Change the sourceobject of subform to a new recordset

Posted on 2003-11-08
4
648 Views
Last Modified: 2008-01-09
Hi,

I have a subform. i want to change the sourceobject of the subform to a new recordset. In other words i want to show the records from a new recordset in the subform. But when i tried to change the sourceobject of subform it gave me an error "the setting you entered isn't valid for this property".  Is there any way to do so.
My emailid is agarwalp@lucent.com
0
Comment
Question by:pradeep_no1
4 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
Comment Utility
For example; in the click event of a button on the main form:
Us e you own names for mysubformctl, and your own sql statement.


Dim strsql
strsql = "Select * from mytable where thisfield >5"
me.mysubformctl.form.recordsource = strsql

Pete
0
 
LVL 2

Expert Comment

by:JethroUK
Comment Utility
or if you have already defined the queries to use on a subform:


recordsource = "MyQuery"
requery 'repopulate the form with the new data
0
 
LVL 39

Expert Comment

by:stevbe
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: peter57r {http:#9706713}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

stevbe
EE Cleanup Volunteer
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now