Solved

Change the sourceobject of subform to a new recordset

Posted on 2003-11-08
4
662 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
[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 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 9706713
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
ID: 9707034
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
ID: 10025070
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

688 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