Run-time error '424'

  • Thread starter Thread starter GLT
  • Start date Start date
G

GLT

Can anyone advise why I am getting a run-time error with this line (and what
I need to do to get it working?):

Me.Parent!Form.Bookmark = rst.Bookmark 'reposition the form


Here is the code I am trying to run:

Sub Form_Click()
Dim rs As DAO.Recordset
If Me.Parent.Dirty Then
Me.Parent.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone

rs.FindFirst "[RecID] = '" & Me.RecID & "'"

If Not rs.NoMatch Then
Me.Parent!Form.Bookmark = rst.Bookmark 'reposition the form
Me.Parent![ServerList].Requery
End If
Set rs = Nothing

End Sub

Any assistance is always greatly appreciated...

Cheers,
GLT.
 
GLT said:
Can anyone advise why I am getting a run-time error with this line (and
what
I need to do to get it working?):

Me.Parent!Form.Bookmark = rst.Bookmark 'reposition the form


Here is the code I am trying to run:

Sub Form_Click()
Dim rs As DAO.Recordset
If Me.Parent.Dirty Then
Me.Parent.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone

rs.FindFirst "[RecID] = '" & Me.RecID & "'"

If Not rs.NoMatch Then
Me.Parent!Form.Bookmark = rst.Bookmark 'reposition the form
Me.Parent![ServerList].Requery
End If
Set rs = Nothing

End Sub

Any assistance is always greatly appreciated...


The syntax of the statement is wrong. Correct syntax would be:

Me.Parent.Bookmark = rst.Bookmark

However, I think there's another problem. I take it that this code is
running on a subform, right? And you're trying to position the subform's
parent form to the record that matches the subform record that was clicked?

If those assumptions are correct, you must also change this line:
Set rs = Me.RecordsetClone

.... to this:

Set rs = Me.Parent.RecordsetClone

You must use the RecordsetClone of the parent form, not the subform.
 
Hi Dirk,

You are 100% correct with your assumptions - I indeed am trying to update a
mainform by clicking a record in a Subform.

It works perfect... thanks for your assistance you have made my day :)
 
Back
Top