CJBIRKIN
Drink!
- Local time
- Today, 22:49
- Joined
- May 10, 2002
- Messages
- 256
Hi
I have an unbound subform whose sourceobject changes. I need to pass the subform as a variable to a module. To complicate matters slightly i have a main form with an unbound subform as well.
Forms!FRM_FRAMES!FRAME_2
main form and unbound subform
Frame_2 then takes the form with the unbound subform.
Forms!FRM_STAFF_DETAILS!FRAME_3 subform
so i think that it should be something like
Forms!FRM_FRAMES!FRAME_2.forms!FRAME_3
With FRAME_3 being the form that i want to use in my function.
If the sourceobject in FRAME_3 is FRM_LEAVE
I can do the following
CountRecordsDisplay Form_FRM_LEAVE
and that works fine but as the sourceobject changes in FRAME_3 i don't want to hard code the form names
(PS can anyone explain the "Form_" part of this is it some sort of internal Access reference?)
I also tried ;
Dim StrFrmName as String
StrFrmName = Form_FRM_STAFF_DETAILS.FRAME_3.SourceObject
' NB StrFrmName = "FRM_LEAVE"
CountRecordsDisplay forms(StrFrmName)
which doesn't work. I get the error "can't find the form FRM_LEAVE"
and
CountRecordsDisplay forms("FORM_" & StrFrmName)
which says the same thing as well.
Any Ideas?
Cheers Chris
I have an unbound subform whose sourceobject changes. I need to pass the subform as a variable to a module. To complicate matters slightly i have a main form with an unbound subform as well.
Forms!FRM_FRAMES!FRAME_2
main form and unbound subform
Frame_2 then takes the form with the unbound subform.
Forms!FRM_STAFF_DETAILS!FRAME_3 subform
so i think that it should be something like
Forms!FRM_FRAMES!FRAME_2.forms!FRAME_3
With FRAME_3 being the form that i want to use in my function.
If the sourceobject in FRAME_3 is FRM_LEAVE
I can do the following
CountRecordsDisplay Form_FRM_LEAVE
and that works fine but as the sourceobject changes in FRAME_3 i don't want to hard code the form names
(PS can anyone explain the "Form_" part of this is it some sort of internal Access reference?)
I also tried ;
Dim StrFrmName as String
StrFrmName = Form_FRM_STAFF_DETAILS.FRAME_3.SourceObject
' NB StrFrmName = "FRM_LEAVE"
CountRecordsDisplay forms(StrFrmName)
which doesn't work. I get the error "can't find the form FRM_LEAVE"
and
CountRecordsDisplay forms("FORM_" & StrFrmName)
which says the same thing as well.
Any Ideas?
Cheers Chris

PHP:
Public Function CountRecordsDisplay(Frm As Form)
blah blah....
End Function