Can't get the parent record to match sub

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can't get the parent record to match sub when I click on field in subreport.
Private Sub CheckNumber_Click()
Parent!RecordsetClone.FindFirst "[CheckNumber] = '" & Me[CheckNumber] & "'"



Getting run-time error '2465'
MAO Can't find the field RecordsetClone...
 
A few possible problems.

1) Do you have a Reference set for DAO? In the code window go to
Tools|References

2) Subreport or subform?

3) Is CheckNumber a text or number value? You have it as text judging by the
quotes.

4) Me[CheckNumber] should be Me![CheckNumber] or Me.[CheckNumber]. Since
there are no spaces in the name, the brackets can be omitted if you prefer.

5) Is CheckNumber the name of the field, textbox, or both? If both, try
changing the name of the textbox to txtCheckNumber to get rid of the
ambiguous name.

6) Try Me.Parent instead of just Parent.

7) I believe Parent!RecordsetClone should be Me.Parent.RecordsetClone
(period instead of exclamation).

8) While you may get the RecordsetClone to do this search, moving the clone
won't move the form's recordset. You can either work directly with the
form's recordset instead of the clone or you'll need to set the clone to an
object variable so that you can refer to it again (i.e. refer to the same
copy of the clone) when the record is found and use that to tell the form's
recordset to move.

Example:
Dim rst As DAO.Recordset
Set rst = Me.Parent.RecordsetClone
rst.FindFirst "[CheckNumber] = " & Me![CheckNumber]
If Not rst.NoMatch Then
Me.Parent.Bookmark = rst.Bookmark
End If
rst.Close
Set rst = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top