Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method or data member not found

Status
Not open for further replies.

Greaser

Technical User
Aug 1, 2001
84
0
0
CA
Hi,
I have the following code attached to several subforms.

Private Sub viewCommStratBtn_Click()
On Error GoTo Err_viewCommStratBtn_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "ITSCommStratsFrm"

stLinkCriteria = "[ITSCommStratsID]=" & Me![ITSCommStratsID]
Me.Refresh
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_viewCommStratBtn_Click:
Exit Sub

Err_viewCommStratBtn_Click:
MsgBox Err.Description
Resume Exit_viewCommStratBtn_Click

End Sub

"Me.Refresh" gives me the following compiling error:
"Method or data member not found"

Note that the code works.
Thanks.
Cheers,
John

 
NOTE:
The same compile error is generated by the line "Me.Bookmark" in the following code:

Private Sub ITSCombo_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ITSNo] = '" & Me![ITSCombo] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub
 
Good Morning Greaser,

What is the refresh command suppose to be doing? The recordsetclone command should not have the second '.' and should be:
me.recordsetclone.

Also, you should close the clone recordset before ending the sub:
rs.close
 
Hi stix4t2,

I use Me.Refresh to save the recordset before opening a form that will use the data inputed in the present form.

When I try using the recordsetclone command, I get the same error message as for the Me.Bookmark command.

Note that I have used similar code several times in the past (including in this project) without generating this error message.
 
Always declare objects as explicitly as possible to avoid problems.
Not
Dim rs As Object
But
Dim rs as DAO.recordset

This should work regardless once you fix the recordsetclone problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top