G
Guest
Can someone point out my error to this scenario:
I have a frmMain with 2 subforms. Subform1 is in Datasheet view to enter
various trnsactions. Subform2 contain additional details for certain
Transaction type in subform1. Thus, I only need subform2 populated if the
user select Transaction type 3, for example. So, Subform2 is unbound when
frmMain loaded but I want to manual set the recordsource and master and child
link in the Subform1_AfterUpdate if TransactionType=3.
I get the error 2467 "The expression you entered refer to an object that
doesn't exist or is closed" in the Set statment.
My SetSubform2 is as followed:
Dim sSQL As String
Dim frmSub As Form
Set frmSub = Forms!frmMain.Controls("frmLOBSub").Form <--PROBLEM HERE
frmSub.LinkMasterFields = "StID"
frmSub.LinkChildFields = "StID"
sSQL = "SELECT * FROM tblEmployee WHERE [StID]='" & Me!StID & "'"
frmSub.RecordSource = sSQL
frmSub.Refresh
end sub
frmLOBSub is the name of the subform2 control on the frmMain. What is wrong?
Thanks in advance!
I have a frmMain with 2 subforms. Subform1 is in Datasheet view to enter
various trnsactions. Subform2 contain additional details for certain
Transaction type in subform1. Thus, I only need subform2 populated if the
user select Transaction type 3, for example. So, Subform2 is unbound when
frmMain loaded but I want to manual set the recordsource and master and child
link in the Subform1_AfterUpdate if TransactionType=3.
I get the error 2467 "The expression you entered refer to an object that
doesn't exist or is closed" in the Set statment.
My SetSubform2 is as followed:
Dim sSQL As String
Dim frmSub As Form
Set frmSub = Forms!frmMain.Controls("frmLOBSub").Form <--PROBLEM HERE
frmSub.LinkMasterFields = "StID"
frmSub.LinkChildFields = "StID"
sSQL = "SELECT * FROM tblEmployee WHERE [StID]='" & Me!StID & "'"
frmSub.RecordSource = sSQL
frmSub.Refresh
end sub
frmLOBSub is the name of the subform2 control on the frmMain. What is wrong?
Thanks in advance!