Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do insert and remove RecordSource as needed?

Status
Not open for further replies.
Jan 14, 2002
143
US
Howdy,

I have a bunch of subforms in a main form that I only make visible when needed. The problem of course is that it takes forever to load the main form with a bunch of records being loaded from a bunch of forms. So my question is how do I set the forms recordsource to nothing until I call it up?

form.recordsource="" doesn't work



 

Me.RecordSource = "select something......." this will override the reference under the data tab. If there is no reference under the data tab then you should be able to override (remove reference under data tab). That means all the forms would need the SQL as a string on the record source.

Actually, you don't need to remove if you use the following sequence
In the OnOpen event

If form is invisible then (however you determine this)
exit sub
end if
Me.RecordSource = "Your actual sql string"
 
oops! I take that back. If you use the suggested sequence you will need to remove from the data tab.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top