Results 1 to 4 of 4
  1. #1
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250

    Update Or Cancelupdate Without Addnew Or Edit

    Hi all,

    I am dealing with this error when I try to edit data in my Access form:
    Update Or Cancelupdate Without Addnew Or Edit



    The weird part is that the error doesn't happen every time. It seems completely random to me and my colleagues. I can edit the form 2 times and when I try to edit one more time, this error pops.

    Please see the attached screenshots:
    Click image for larger version. 

Name:	pic1.jpg 
Views:	22 
Size:	72.7 KB 
ID:	42808Click image for larger version. 

Name:	pic2.jpg 
Views:	22 
Size:	68.6 KB 
ID:	42809

    This is the VBA code behind the form:

    Code:
    Option Compare Database
    
    Private Sub KontaktRelOsobaDatum_AfterUpdate()
        Me.Aktualizace = Date
    End Sub
    
    Private Sub ObecnyFollowUpDatum_AfterUpdate()
        Me.Aktualizace = Date
    End Sub
    
    Private Sub ObecnyKontaktDatum_AfterUpdate()
        Me.Aktualizace = Date
    End Sub
    
    Private Sub Prubeh_AfterUpdate()
        Me.Aktualizace = Date
    End Sub
    
    Private Sub Příkaz43_Click() 'ulozit
        If IsNull(NazevFirmy) Then
            MsgBox ("Musíte zadat název firmy.")
        Else
            DoCmd.Close acForm, "frmDEObchodniTrychtyr", acSaveYes
            DoCmd.OpenForm "frmObchodniTrychtyr"
        End If
    End Sub
    
    Private Sub Příkaz54_Click() 'zrusit
    
        Me.Undo
        DoCmd.Close acForm, "frmDEObchodniTrychtyr", acSaveNo
        DoCmd.OpenForm "frmObchodniTrychtyr"
            
    End Sub
    
    Private Sub RelOsobaFollowUpDatum_AfterUpdate()
        Me.Aktualizace = Date
    End Sub
    
    Private Sub Ukol_AfterUpdate()
        Me.Aktualizace = Date
    End Sub
    I would appreciate any advice.

    Tomas

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Try to remove all lines with Me.Aktualizace = Date and just add it to the BeforeUpdate event of the form itself (I assume it is a time stamp to show when record was updated).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Be aware that,
    Code:
    Private Sub Príkaz43_Click()    'ulozit
        If IsNull(NazevFirmy) Then
            MsgBox ("Musíte zadat název firmy.")
        Else
            DoCmd.Close acForm, "frmDEObchodniTrychtyr", acSaveYes
            DoCmd.OpenForm "frmObchodniTrychtyr"
        End If
    End Sub
    the "acSaveYes" does NOT save the data, it is asking if you want to save changes to the DESIGN of the object (in this case a Form). The data is automatically saved.

    So you do not need it in the command .... Use
    Code:
    DoCmd.Close acForm, "frmDEObchodniTrychtyr"

    Same goes for the close command in
    Code:
    Private Sub Príkaz54_Click() 'zrusit
    
        Me.Undo
        DoCmd.Close acForm, "frmDEObchodniTrychtyr", acSaveNo
        DoCmd.OpenForm "frmObchodniTrychtyr"
            
    End Sub

  4. #4
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250
    Quote Originally Posted by Gicu View Post
    Try to remove all lines with Me.Aktualizace = Date and just add it to the BeforeUpdate event of the form itself (I assume it is a time stamp to show when record was updated).

    Cheers,
    Thanks. The error was actually caused by the line:
    Me.Aktualizace = Date

    I tried to delete the lines completely but it didn't solve the issue unfortunately.

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

Similar Threads

  1. Update or CancelUpdate without AddNew or Edit -- 2019
    By bw.brandiwoodson in forum Forms
    Replies: 10
    Last Post: 12-06-2019, 01:44 PM
  2. Update or CancelUpdate without AddNew or Edit
    By westcoastbmx in forum Forms
    Replies: 5
    Last Post: 11-07-2019, 09:01 PM
  3. Replies: 1
    Last Post: 07-18-2015, 07:59 PM
  4. Replies: 9
    Last Post: 04-01-2011, 10:31 AM
  5. Replies: 3
    Last Post: 03-07-2011, 08:37 PM

Posting Permissions

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