Results 1 to 6 of 6

Update or Cancel Update without Add New or Edit error

  1. #1
    louise is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    76

    Update or Cancel Update without Add New or Edit error

    Hello,
    A few weeks ago, I asked and received a useful answer to a question I had about forms. The thread was entitled: How to edit a copy of a text field while maintaining the unaltered original.



    I wanted a form to display an original course description in one text box and be able to see, edit, and save the text in a second field.
    I used this code in the form's OnCurrent:

    Private Sub Form_Current()
    Me.cboSelectACourse = Me.AllCurricID
    If IsNull(Me.Description_100Words) Then Me.Description_100Words = Me.Description
    End Sub

    This has worked well, except that today I wanted to paste a whole new text into the field Description_100Words (which is set to display the original, Description) and I got this error: "Update or CancelUpdate without Add New or Edit.

    Can you help me address the possibility that users may want to cut and paste in entire new text instead of editing existing text?

    Thanks!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,863
    It seems the field that Me.Description_100Words is bound to is not updateable. Are you showing all of the code being used?

  3. #3
    louise is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    76
    Hello,
    The field Description_100Words can be edited in the original table and in a query...so does that mean it's is updateable? just not in this form?

    I am having trouble consistently reproducing the error. And, relatedly perhaps, in some instances the combo box on the form, for selecting the course to work on, does not update as I move from one record to the next after I have tried to edit the Description_100Words.

    I have included all my code, since there are combo box commands in there as well. As you will note, the set up of "original field" and "to be edited field" is used for several other pairs.

    Thanks!


    Private Sub Form_Current()
    Me.cboSelectACourse = Me.AllCurricID
    If IsNull(Me.Description_100Words) Then Me.Description_100Words = Me.Description
    If IsNull(Me.ShortCourseTitle) Then Me.ShortCourseTitle = Me.CourseTitle
    If IsNull(Me.PresIntro_100Words) Then Me.PresIntro_100Words = Me.PresenterIntroduction
    If IsNull(Me.PresTagForAlpHorn) Then Me.PresTagForAlpHorn = Me.PresenterTitle_Position
    End Sub
    Private Sub Form_Load()
    Me.cboSelectACourse = Me.cboSelectACourse.ItemData(0)
    End Sub

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,863
    The only thing I see out of place is this
    Me.cboSelectACourse = Me.AllCurricID

    You are already assigning a value to cboSelectACourse during the On Load event. I do not know if I would expect an error but it does not seem well thought out, at first blush anyway.

    As for whether or not the field is updateable, apparently, it is. The fact that the symptom appears to be random is concerning. We should try to understand why it appears to be random. How, exactly, are you doing this? ... "except that today I wanted to paste a whole new text into the field Description_100Words "

  5. #5
    louise is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    76
    Hi,
    Thanks for your response. I think I now have two, related problems.
    Combo Box: Where should the coding be?
    1. I have the embedded macro that comes through the wizard.
    2. Then, to coordinate the bottom record arrow and the combobox, I read that I should insert what I sent in my earlier question: OnCurrent: Me.[combobox] = Me.[recordID]
    3. Then, to set combo to the first item on the list: OnLoad: me.[combobox] = me.[combobox].ItemData(0)
    #3 does not always seem to work
    AND, sometime the combobox shows nothing, even as I "arrow through" the records.

    Then, the problem I wrote about. Without the combo box, this seems to be Ok: add to Description, or add to Description_100Words...can exit without error.

    I tried a simple form with a "plain" combo box with neither of the two other codes I just mentioned.
    And, errors occur when the descriptions field is blank (like it's trying to set Description_100Words and can't) or when I edit the fields.
    The two errors: The combo box "freezes" , i.e., does not match the record after editing or a blank field in Description -- it stay where it was when it hit one of those conditions
    Second errors: can't exit without the error message about Update or cancel...."

    I would greatly appreciate help on both these issues. Sorry for two to be combined.
    Thanks

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,863
    Quote Originally Posted by louise View Post
    ...And, errors occur when the descriptions field is blank (like it's trying to set Description_100Words and can't) or when I edit the fields...
    I would expect this to happen if there is not a value in your descriptions field. I think the issue is related to the fact that you have an embedded macro in your Combo. Sometimes, perhaps many times, VBA will conflict with macros that are embed in controls.

    What functionality are you trying to get from the Macro? I would suggest avoiding the macro and build your Combo from the ground up. You will need to understand a few of the properties of the combo. You can download and watch a Video Tutorial about the combo, if you are so inclined. The first video (a 40 minute video) in a series of videos I created discusses the properties of the combo. I posted info about the series here.

    https://www.accessforums.net/tutoria...ers-52741.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Update or CancelUpdate without AddNew or Edit
    By westcoastbmx in forum Forms
    Replies: 5
    Last Post: 11-07-2019, 09:01 PM
  2. Replies: 2
    Last Post: 03-19-2015, 01:33 PM
  3. edit/update
    By vientito in forum Programming
    Replies: 1
    Last Post: 10-30-2014, 06:03 AM
  4. Detecting a Before Update Cancel
    By EddieN1 in forum Programming
    Replies: 3
    Last Post: 06-09-2013, 08:04 PM
  5. combo box disable edit (update)
    By jheacox in forum Forms
    Replies: 10
    Last Post: 09-28-2009, 10:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums