A
Amy Blankenship
I have a popup form I'd like to potentially call from more than one place.
So I'm trying to pass it the path to the calling subform and have it set a
control value on the calling form when it is closed. So what I have is
this:
in the calling form:
Private Sub LaunchQuestion_Click()
Dim WhereClause As String
If Me.QuestionID Is Not Null Then
WhereClause = "QuestionID = " + Me.QuestionID
Else
WhereClause = "IS NULL"
End If
DoCmd.OpenForm "Question Subform", , , WhereClause, , acDialog,
Me.Parent.Parent.Parent.Name + "+" + Me.Parent.Parent.Name + "+" +
Me.Parent.Name + "+" + Me.Name
Debug.Print Me.Parent.Parent.Name + "+" + Me.Parent.Name + "+" + Me.Name
End Sub
Then, in the popup:
Private Sub Form_Unload(Cancel As Integer)
Dim arrArg As Variant, strForm As Variant, strEval As String
arrArg = Split(Me.OpenArgs, "+")
strEval = "Forms"
For Each strForm In arrArg
strEval = strEval & "![" & strForm & "]"
Next strForm
strEval = strEval & "=" & Me.QuestionID
Eval (strEval)
End Sub
I get an error message from Access "A property of the Automation object
requires or returns a value that isn't supported by visual basic."
Obviously, there's got to be a way to reference a form when the full path to
it can be a variable length, but I'm durned if I know what it is. I tried
just passing a full on reference to the control in question, but access
didn't like the data type.
Thanks;
Amy
So I'm trying to pass it the path to the calling subform and have it set a
control value on the calling form when it is closed. So what I have is
this:
in the calling form:
Private Sub LaunchQuestion_Click()
Dim WhereClause As String
If Me.QuestionID Is Not Null Then
WhereClause = "QuestionID = " + Me.QuestionID
Else
WhereClause = "IS NULL"
End If
DoCmd.OpenForm "Question Subform", , , WhereClause, , acDialog,
Me.Parent.Parent.Parent.Name + "+" + Me.Parent.Parent.Name + "+" +
Me.Parent.Name + "+" + Me.Name
Debug.Print Me.Parent.Parent.Name + "+" + Me.Parent.Name + "+" + Me.Name
End Sub
Then, in the popup:
Private Sub Form_Unload(Cancel As Integer)
Dim arrArg As Variant, strForm As Variant, strEval As String
arrArg = Split(Me.OpenArgs, "+")
strEval = "Forms"
For Each strForm In arrArg
strEval = strEval & "![" & strForm & "]"
Next strForm
strEval = strEval & "=" & Me.QuestionID
Eval (strEval)
End Sub
I get an error message from Access "A property of the Automation object
requires or returns a value that isn't supported by visual basic."
Obviously, there's got to be a way to reference a form when the full path to
it can be a variable length, but I'm durned if I know what it is. I tried
just passing a full on reference to the control in question, but access
didn't like the data type.
Thanks;
Amy