I'm using the following in the After Update of a combo box to filter records on a form with a datasheet subform (the subform's Default view is Datasheet):
Private Sub cboDvdFilter_AfterUpdate()
Dim strSQL As String
Dim strAll As String
If Me!cboDvdFilter.Column(1) = "<<All>>" Then
strAll = "SELECT * FROM tblDvd ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me.RecordSource = strAll
Me!frmDvdSub.RowSource = Me.RecordSource
Else
strSQL = "SELECT * FROM tblDvd WHERE (((DvdMovieTypeID)=" & [cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me.RecordSource = strSQL
Me!frmDvdSub.RowSource = Me.RecordSource
End If
End Sub
When I select a row in the cbo I get the following error:
Run-Time error '438': Object doesn't support property or method
The debug window highlights the 'Me!frmDvdSub.RowSource = Me.RecordSource' row of the code. With frmDvdSub being the datasheet subform name.
Any way around this?
James