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
 
Top