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
Printable View
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
If you declare the recorset as public in a module, it will be assessable in all forms.
David Paulson
Is there any other way? because I would like to avoid using global variable.
Thanks,
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.
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.