Error 3326: This Recordset is not Updateable

S

slim

Further to my problem with updating price field, I've
changed the code to read as follows and it comes up with
the error 3326 message. What is wrong with it? Can anyone
help? Please!!! I'm a novice at this.
Private Sub CurrentPrice_Enter()
Dim mydb As Database
Dim productSet As Recordset
Dim ProductNumber As Integer
Dim UnitCost As Double

Set mydb = CurrentDb()
Set productSet = mydb.OpenRecordset("tblProducts")

ProductNumber = [Form_frmCustomersOrderDetails
subform].ProdID.Value
productSet.Index = "PrimaryKey"
productSet.Seek "=", ProductNumber

UnitCost = productSet!UnitPrice
[Form_frmCustomersOrderDetails subform].CurrentPrice.Value
= UnitCost

productSet.Close

End Sub
 
A

Arvin Meyer

Seek only works on local tables (or if you set a path to the database which
is the container for the table) So if you did something like:

Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("FullPathToData.MDB")
Set rst = db.OpenRecordset("tblSourceTable", dbOpenTable)

'Now you can use the Seek method on this recordset

Alternatively, use the FindFirst method.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

slim said:
Further to my problem with updating price field, I've
changed the code to read as follows and it comes up with
the error 3326 message. What is wrong with it? Can anyone
help? Please!!! I'm a novice at this.
Private Sub CurrentPrice_Enter()
Dim mydb As Database
Dim productSet As Recordset
Dim ProductNumber As Integer
Dim UnitCost As Double

Set mydb = CurrentDb()
Set productSet = mydb.OpenRecordset("tblProducts")

ProductNumber = [Form_frmCustomersOrderDetails
subform].ProdID.Value
productSet.Index = "PrimaryKey"
productSet.Seek "=", ProductNumber

UnitCost = productSet!UnitPrice
[Form_frmCustomersOrderDetails subform].CurrentPrice.Value
= UnitCost

productSet.Close

End Sub
 

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

Top