D
David C. Holley
I'm trying to alter the recordsource of a subform at runtime (something I've
done before) and I'm just not getting why I'm getting an error - "You
entered an expression that has an invalid reference to the property
Form/Report." The code craps out where I've got the asterik. I snooped
around trying to reference the controls and properties of the subform via
the Immediate Window, but no luck. The subform is on tabctl, but its my
understanding that that shouldn't be a problem.
Private Sub Form_Open(Cancel As Integer)
Dim strRecordSource As String
'Massage the recordsource, the criteria for the subform changes based on
its usage
* If Right(Me.subfrmTrailerActivityComments.Form.RecordSource, 1) = ";"
Then
strRecordSource =
Left(Me.subfrmTrailerActivityComments.Form.RecordSource,
Len(Me.subfrmTrailerActivityComments.Form.RecordSource) - 1)
Else
strRecordSource = Me.subfrmTrailerActivityComments.Form.RecordSource
End If
strRecordSource = strRecordSource & "WHERE lngTrailerActivityHeaderId =
me.parent.lngTrailerActivityHeaderId ORDER BY lngCommentId"
Me.subfrmTrailerActivityComments.Form.RecordSource = strRecordSource
Me.subfrmTrailerActivityComments.Form.lstComments.RowSource =
strRecordSource
Me.subfrmTrailerActivityComments.Form.lstComments.Requery
Me.subfrmTrailerActivityComments.Requery
End Sub
?err.Number
2455
?err.Description
You entered an expression that has an invalid reference to the property
Form/Report.
?me.controls("subfrmTrailerActivityComments").name
subfrmTrailerActivityComments
?me.Controls("subfrmTrailerActivityComments").form.controls.count
[Error]
?me.Controls("subfrmTrailerActivityComments").controltype
112
?acSubform
112
?[Forms]![frmTrailerActivity_ByShow]![subfrmTrailerActivityComments].form!lstComments.controltype
[Error]
done before) and I'm just not getting why I'm getting an error - "You
entered an expression that has an invalid reference to the property
Form/Report." The code craps out where I've got the asterik. I snooped
around trying to reference the controls and properties of the subform via
the Immediate Window, but no luck. The subform is on tabctl, but its my
understanding that that shouldn't be a problem.
Private Sub Form_Open(Cancel As Integer)
Dim strRecordSource As String
'Massage the recordsource, the criteria for the subform changes based on
its usage
* If Right(Me.subfrmTrailerActivityComments.Form.RecordSource, 1) = ";"
Then
strRecordSource =
Left(Me.subfrmTrailerActivityComments.Form.RecordSource,
Len(Me.subfrmTrailerActivityComments.Form.RecordSource) - 1)
Else
strRecordSource = Me.subfrmTrailerActivityComments.Form.RecordSource
End If
strRecordSource = strRecordSource & "WHERE lngTrailerActivityHeaderId =
me.parent.lngTrailerActivityHeaderId ORDER BY lngCommentId"
Me.subfrmTrailerActivityComments.Form.RecordSource = strRecordSource
Me.subfrmTrailerActivityComments.Form.lstComments.RowSource =
strRecordSource
Me.subfrmTrailerActivityComments.Form.lstComments.Requery
Me.subfrmTrailerActivityComments.Requery
End Sub
?err.Number
2455
?err.Description
You entered an expression that has an invalid reference to the property
Form/Report.
?me.controls("subfrmTrailerActivityComments").name
subfrmTrailerActivityComments
?me.Controls("subfrmTrailerActivityComments").form.controls.count
[Error]
?me.Controls("subfrmTrailerActivityComments").controltype
112
?acSubform
112
?[Forms]![frmTrailerActivity_ByShow]![subfrmTrailerActivityComments].form!lstComments.controltype
[Error]