Share via

Run-Time error '438': Object doesn't support property or method

Anonymous
2011-09-14T23:35:04+00:00

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

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-09-15T05:38:18+00:00

I think what you want is...

Me!frmDvdSub.Form.RecordSource = strSQL

That whole circular Reference thing is not going to work.  Oh, and you probably want to add a requery to that.

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-09-15T16:39:28+00:00

    Is that "I see" that it worked for you OR "I see" in that did not work?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-09-15T10:49:01+00:00

    I see.

    Thanks,

    James

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-09-15T00:18:28+00:00

    I wasn't referring to the subform properly:

    Me!frmDvdSub.Form.RecordSource = Me.RecordSource

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2011-09-15T00:06:43+00:00

    I changed the RowSource to Record Source. I had copied the code from a list box but I'm getting the same error.

    Was this answer helpful?

    0 comments No comments