invalid operation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • solar

    #1

    invalid operation



    CaN somebody help me find the error in my code ? I get the error
    "invalid operation" with the following line :

    tdf.Fields("Cus tomerID") = 121



    Public Function Test()
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim fld As DAO.Field
    Dim tdf As DAO.TableDef

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecords et("orders1", dbOpenDynaset)
    Do While Not rst.EOF

    rst.MoveNext
    Set tdf = dbs.TableDefs(" Orders1")

    Set fld = tdf.Fields("Cus tomerID')
    tdf.Fields("Cus tomerID") = 121

    Loop

    rst.Close
    Set rst = Nothing
    Set dbs = Nothing
    End Function

  • pietlinden@hotmail.com

    #2
    Re: invalid operation

    try
    Do While Not rst.EOF

    rst.Edit
    rst.Fields("Cus tomerID")=121
    rst.Update
    rst.MoveNext

    Loop

    Comment

    Working...