ms-accessformsvbasubformopenargs

MS Access - Open Argument between sub forms? can I pass a value? do I need to?


So I have a sub form that creates a record (and record it), and then another sub form opens up for data entry...however can I still use an open arg to pass the value (ProjectID) between these sub forms.

I know exactly how to do this with forms, but trying this with subforms is a little different.

docmd.openform "FormExample",,,,,,Passingvalue

but can't do it like this:

 me.MyChild.SourceObject = "SecondSubForm",,,,,,PassingValue

so yeah the above might look ridiculous to those who know the right way, but I thought that this would illustrate exactly what I am trying to do.

So how can I pass the value? Do I even need to with subforms instead of forms? or would this variable hold my value even though it was created in the first sub form?

thanks justin


Solution

  • I don't think there's any way to pass an OpenArg with SourceObject =

    Can it work to assign the value to a control after you set the SourceObject?

    Me.MyChild.SourceObject = "SecondSubForm"
    Me.MyChild!SomeControl = PassingValue