Attempting to set subform data from on Current event on Main Form.
The last line is bringing up
Run-time error '3011':
The Microsoft Jet database engine could not find the object
'~sq_cForm1~sq_cChild0'. Make sure the object exists and that you
spell its name and the path name correctly.
I believe QueryK is being built ok (I can run it on it's own).
I don't have an object called '~sq_cForm1~sq_cChild0' .. there's just Form1 and Child0.
I obviously have something wrong. How does one assign a query (to the subform) as I'm attempting? Maybe it is not 'SourceOnbject' ?
Thanks for any info.
Code:
Private Sub Form_Current()
Me.Caption = Me!TestField
Dim sql As String, MyQuery As QueryDef
sql = "Select * from Query8 where (((Query8.TestField)= '" & Me!TestField & "'));"
Set MyQuery = CurrentDb.QueryDefs("QueryK")
MyQuery.sql = sql$
Set MyQuery = Nothing
Me.Child0.SourceObject = "QueryK"
End Sub
Run-time error '3011':
The Microsoft Jet database engine could not find the object
'~sq_cForm1~sq_cChild0'. Make sure the object exists and that you
spell its name and the path name correctly.
I believe QueryK is being built ok (I can run it on it's own).
I don't have an object called '~sq_cForm1~sq_cChild0' .. there's just Form1 and Child0.
I obviously have something wrong. How does one assign a query (to the subform) as I'm attempting? Maybe it is not 'SourceOnbject' ?
Thanks for any info.