KuroNeko
KuroNeko

Reputation: 331

Vba Access error: Method or data member not found

I have been trying to open a contracts form from contracts_all page. I want to open all the records on the contracts_all form but only show the specific one clicked on. To show this one particular record, the button uses ID found in the contracts_all form. I have managed to go this far with the help of various people in different forums but now I am getting an error which says "Compiler error; Method or data member not found".. Please help! Thanks in advance.

Dim Rs As Recordset
Dim Test As Integer
Dim varBookmark As Variant
DoCmd.OpenForm "Contracts"

Set Rs = Forms!Contracts.RecordsetClone
    Rs.FindFirst ("[ID] = '" & Me![ID] & "'")
varBookmark = Rs.Bookmark
 Forms!Contracts.Form.Bookmark = varBookmark

If Rs.NoMatch Then
  MsgBox "That does not exist in this database."
Else
End If

Upvotes: 1

Views: 37792

Answers (3)

Juddles
Juddles

Reputation: 1

Another possibility is that the fields you are attempting to clear are set to Date or Number format, for example, which was the case in my database. I did learn a lot from looking through numerous threads on this topic though!

Upvotes: -2

dennythecoder
dennythecoder

Reputation: 772

It looks like you may not have the appropriate references set. Make sure you have Microsoft DAO checked. Note that these methods will not work in ADO. :-)

Click Tools, then References, then Microsoft DAO 3.6 (or highest version available). Not having the correct library referenced is easy to miss if you copied and pasted code into your project.

Cheers, LC

Upvotes: 2

Johnny Bones
Johnny Bones

Reputation: 8402

Try replacing

Rs.FindFirst ("[ID] = '" & Me![ID] & "'")

with

Rs.FindFirst ("[ID] = '" & Forms!contracts_all![ID] & "'")

That may be slightly off, but I'm guessing it's because your active form has changed from contracts_all to Contracts, so you can no longer use the Me! reference.

Upvotes: 1

Related Questions