Hi,

Need advice with this problem "Excel 2007 Sheet ADODB.RecordSet become Nothing when assign to pop up form (VB 6 macro code)"


At Sheet i can connect to MySQL, return recordset from MySQL and display record row by row at the Sheet, no issue on this.

What i try to do is
When i double click the row record, a new form will pop up and display the clicked record to the form.

But the recordset i "pass" or assign from Sheet to form become Nothing.


Below is some of the code

At mySheet--------------------------------------------------

Public sheet_rs As ADODB.Recordset

Public Sub atSheet()

Set sheet_rs = New ADODB.Recordset

' id is the clicked record id
' conn is the connection to MySQL
sheet_rs.Open "SELECT * FROM CUSTOMER WHERE ID=" & id, conn

'Open the form
myForm.Show vbModeless <- This will trigger UserForm_Initialize





At myForm------------------------------------------------

Public form_rs As ADODB.Recordset

Public Sub UserForm_Initialize()

Set form_rs = New ADODB.Recordset
Set form_rs = mySheet.sheet_rs <--- sheet_rs become Nothing here


Why sheet_rs become Nothing ? How to make it work ?


regards

johnnighter