I want to pass an object to a class and have that object retain all references, then need to pass that object over to a Form. Trying my code produces run-time error 438, "Object doesn't support this property or method".
I don't know what I'm doing wrong, but I need to pass an object reference to a different form and be able to pull the values from it.
Private TestObj As New Test
Private ScanObj As New Scan
Private Sub cmdLogin_Click()
Set TestObj.ScanObj = ScanObj 'ScanObj is the object that holds my scan data
Set frmScreen.TestObj = TestObj 'Set the TestObj to another Form that needs to use these vals
frmScreen.Test 'Expecting to see a MsgBox with one of the set object vals, but get nothing back. Why?
frmScreen.Show
End Sub
Does my expectation of how this should work, actually work this way?
EDIT:
I've simplified it.
My first form (Login) where I am gathering all my data:
Private TestObj As New Test
Private ScanObj As New Scan
Private Sub cmdLogin_Click()
Set TestObj.ScanObj = ScanObj 'ScanObj is the object that holds my scan data
Set frmScreen.TestObj = TestObj 'Set the TestObj in my Test class
TestObj.Test 'Call the Test class Test routine that should show one of my values, but instead get runtime 438
frmScreen.Show
Unload Me
End Sub
Then the code from the Test class:
Public ScanObj As Object
Public Sub Test()
MsgBox ScanObj.Get_P
End Sub