Click to See Complete Forum and Search --> : recordset


batsheva
March 27th, 2001, 12:43 PM
I would like to access a recordset in a previous form. Is there a way to pass the variable over to the next form or do i need to make it a global variable?


thnxs

d.paulson
March 27th, 2001, 12:51 PM
If you declare the recorset as public in a module, it will be assessable in all forms.


David Paulson

batsheva
March 27th, 2001, 12:55 PM
Is there any other way? because I would like to avoid using global variable.

Thanks,

sumit_karan
March 27th, 2001, 01:05 PM
You can make a public property on the second form
and set the recordset to that.


Private m_ThisRecordSet as RecordSet

Public Property Set TheRecordSet(rsIn as RecordSet)

set m_ThisRecordSet = rsIn

End Property

And then when you create the form

Dim frm as FormName

set frm = new FormName

Set frm.TheRecordSet = Rs

where Rs is the instance of the recordset
you currently have.

No global variables.

hope this answers your question.

Cubbie
March 27th, 2001, 03:14 PM
Never tried but I don't know why you couldn't use Form1.rs to reference the recordset on another form. Seems rather crude though.