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 strongm 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.

bigfigkid

Programmer
Feb 18, 2003
26
CA
I have a form called : tblINVOICE which contains a field called PRICERATIO. I also have a subform called : tblINVOICEDETAIL Subform with fields called PURCHASEWEIGHT, PRICE, BOATPRICE, and AMOUNT.
I have written this code(below) to calculate what the BOATPRICE and AMOUNT's are for each record in the subform, but I get an error saying : Compile Error: method or data member not found. Also, the .Edit is highlighted when the error message box appears. I can't determine what the problem is.

Private Sub Command33_Click()

Dim blah As Double
Dim rst As Recordset
Set rst = Me.tblINVOICEDETAIL_Subform.Form.RecordsetClone


If rst.RecordCount > 0 Then
With rst
.MoveFirst
While Not .EOF
.Edit
.Fields("PRICE") = .Fields("BOATPRICE") * Form_tblINVOICE.PRICERATIO
.Fields("AMOUNT") = .Fields("PRICE") * .Fields("PURCHASEWEIGHT")
.update
.MoveNext
Wend
End With
Else
'no records found
End If
rst.Close
rst = Nothing
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End Sub
 
I've never seen .edit used.
You've got the recordset open, you should be able to update your fields, then use .Update to save the changes to the record.

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
i commented out the ".Edit" and now I get the following error : run time error 13, type mismatch, with the following line of code highlited :

Set rs = db.OpenRecordset("tblINVOICEDETAIL", dbOpenDynaset)
 
sorry, in my previous post I posted the correct error message but the wrong highlited line, it's the following :

Set rst = Me.tblINVOICEDETAIL_Subform.Form.RecordsetClone
 
Two things:
1 - in VBE - Tools | References - make sure Microsoft DAO 3.# Object Library is checked
2 - explicitly declare any DAO objects

[tt]dim rst as dao.recordset[/tt]

Using DAO recordsets one must use either .edit or .addnew prior to edit or adding a record.

Roy-Vidar
 
Good call RoyVidar. I'll bet it can't figure out whether he wants an ADO or DAO recordset. I always work with ADO, so I'm not familiar with .edit.

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top