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!

Sharing Recordsets between forms (ADO) 1

Status
Not open for further replies.

StormbringerX

Programmer
Dec 14, 2000
102
US
My app has 2 forms. My MainForm sets, intitializes, and opens all of my recordsets. I have added another form which is to be used as a search form. It basically consists of a textbox and a Command button.
I really don't want to create a new recordset for the SearchForm to look through. How can I make the SearchForm use a recordset defined in the MainForm?
Thanks!
Dave
 
There are three ways to do this:

1. Use a Data Environment if you are using VB6

2. Use a global variable and set this to equal the recordset.

3. Create an intialise method for the form and then call this method after the form has been loaded (but not shown) pass in this recordset as a variable and then set a local variable to the recordset and then show the form.

Option 3 is how I normally do it as you have a greater degree of control and flexability.

James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
The recordset can be declared as public in a module.
David Paulson


 
Tnaks James! Appreciate the info. I agree, method 3 seems to suit my purposes best.
Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top