Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    5

    Question Unanswered: Why is it doing this?

    Hi there, got a problem with my Access Database that I cannot fix, joined here to ask your advice, any help is appreciated...I have got a fairly complex form that has been working fine but I have been making changes and now get the "Update or CancelUpdate without AddNew or Edit", now this then wont let me leave a record without hitting esc to reset whatever the field was I was using and if I hit escape again then I can write in the field with no error this time?? Its like hitting esc does something that stops the error from happening? What does the escape key do to a form? Thanks for your help.

    WestWood

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    looks like you have some code that is trying to edit records in a table. somewhere in your code you are issuing a
    Update or CancelUpdate
    without having issued a
    AddNew or Edit

    search the code behind problem form for "Update" and/or "CancelUpdate" and you should find the problem.

    typical sequence should read


    'dim the recordset
    'set the recordset
    'go to whatever record
    recordset.edit 'or .addnew ...this seems to be missing in your case
    recordset!field = whatever
    recordset.update 'or is it CancelUpdate

    ESC does the cancel update for you (experiment with a table... start editing a new record (the pencil pointer appears in the record selector) and hit ESC (the pencil pointer reverts to arrowhead))

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Oct 2003
    Posts
    5
    Hi, thanks for the rely, I looked into that but could not see what was wrong, I have noticed I get this error even if I change a field that has not got any event procedures linked to it? So if I open a form and type a date in a blank field that has no after update or ANY events based upon it, it still throws this error when I try to leave the field? Any more ideas or does code still run anyway after any fields are changed? Thanks again...

    WestWood

  4. #4
    Join Date
    Oct 2003
    Posts
    5
    hmm, just realised sometimes I get the error with just and ok or cancel option and sometimes when pressing other buttons I get the same error but with a debug option? weird - when I click debug I get this code as being the problem...

    Private Sub PickList_AfterUpdate()
    Dim rs As Object
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[ProjectID] = " & [PickList]
    Me.Bookmark = rs.Bookmark <ERROR IS ON THIS LINE???
    ButtonA.SetFocus
    [PickList].Visible = False
    rs.Close
    End Sub

    Thanks,

    WestWood

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •