Microsoft Access - Only Save Form Changes With A Save Button

Поделиться
HTML-код
  • Опубликовано: 19 фев 2024
  • Showing you how you can implment a more typical save button to Microsoft Access form to bypass the default behavior of automatically saving any change made. This permits bringing Access more inline with the manner in which all other software operates and can help novice users out.
    Article(s) on this Subject:
    • www.devhut.net/only-save-reco...
    My Links:
    • www.cardaconsultants.com/ (business)
    • www.devhut.net/ (blog)
  • НаукаНаука

Комментарии • 23

  • @horatiurotar6257
    @horatiurotar6257 4 месяца назад

    It's a simple but beneficial approach. Thanks!!!

  • @janvanantwerp6574
    @janvanantwerp6574 5 месяцев назад

    TKS. Solves a huge problem for me. Looking at making a sub Class Module as there is many forms that i will have to change.

    • @DanielPineault
      @DanielPineault  5 месяцев назад

      This is a great use of a subclass. If you haven't already seen it, look at
      www.devhut.net/converting-form-code-to-a-reusable-class-module/

  • @akokohjoel9854
    @akokohjoel9854 4 месяца назад

    You teach with simplicity

    • @DanielPineault
      @DanielPineault  4 месяца назад

      Thank you for the compliment.
      I try and keep things simple. I want others to be able to do the same thing as I'm demonstrating. I'm not the type of person trying to seem smarter or better than others. I'm simply trying to share information to elevate others.

  • @hassanrozh6579
    @hassanrozh6579 5 месяцев назад

    Easy way but great idea, thanks so much.

  • @abdulhamidalhaddadi2255
    @abdulhamidalhaddadi2255 3 месяца назад

    Thank you

  • @JosephOwino-jf2oj
    @JosephOwino-jf2oj 5 месяцев назад

    Thanks for this. Do you also have a workaround for continous forms?

    • @DanielPineault
      @DanielPineault  5 месяцев назад +1

      This approach works for continuous forms.

  • @xavierbatlle1828
    @xavierbatlle1828 5 месяцев назад

    In the first approach, perhaps I'd set the frm_saveRecord =false in the BeforeUpdate event, to prevent save the record twice if it the same record is modified after saved, and after the second modification, "save" Is not pressed

  • @SAMYTAHER
    @SAMYTAHER 5 месяцев назад

    👍🏻👍🏻👍🏻

  • @neojumpy
    @neojumpy 5 месяцев назад

    Yeah, and as usually, better to put this in a Class, so u than have just one line code in ur form.
    btw, b havior on this kind of solution by OnCurrent: Me.cmd_Save.Enabled = False
    This will create an error, when the control has the focus, so always set the focus on a control that is always avaible.
    Or set the focus only if u have to with this: SetPropertyConditional Me.cmd_Save, "Enabled", False, me.MyMail
    Here is the fct:
    Public Function SetPropertyConditional(obj As Control, prpName As String, Content As Variant, Optional EvasiveControl As Control) As Boolean
    Dim i As Byte
    On Error Resume Next
    For i = 0 To 1
    If Not obj.Properties(prpName) = Content Then obj.Properties(prpName) = Content
    If Err.Number = 0 Then
    SetPropertyConditional = True
    Exit For
    End If
    EvasiveControl.SetFocus
    Err.Clear
    Next
    End Function

    • @DanielPineault
      @DanielPineault  5 месяцев назад

      Classes are great and, yes, this would be a great application, but not everyone uses them so I kept the example simple and accessible to all.
      As for getting an error, it hasn't ever cause such an issue to date.

    • @neojumpy
      @neojumpy 5 месяцев назад

      @@DanielPineault if ur button has the focus, u will get the error. If it can happen, it will happen. But everyone has their own quality standards.

    • @DanielPineault
      @DanielPineault  5 месяцев назад

      The button has to have the focus at that moment in time, yet no error. Not a bad idea to set the focus back into the detail section or previous control. Something to explore. As always, I present the basics, try help novice developers, there will ALWAYS be room for improvement!!! (this is true of all code, without exception!)
      Nice dig though! I sleep quite fine at night thank you.

    • @neojumpy
      @neojumpy 5 месяцев назад

      @@DanielPineault The fact that dirty=false requires error handling should be clear to anyone who is not a complete beginner. I was concerned here with the classic non-obvious error that will catch up you one day. The quick solution of putting an on error resume next before enabled=false should not overwhelm the audience. Class-programming should, I agree with you. In my opion the whole topic is important and very clearly presented. All my forms in this view are structured in this way and the user experience has improved significantly.

    • @zoranstojanovski8407
      @zoranstojanovski8407 2 месяца назад

      The problem is when you have to save invoice, you have invoice number, date of invoice etc.. and then you have items in that invoice. You need master details form and how to make save together or cancel changes. You gonna need temporary recordsets, or temporary tables. In multi user environment it can be chalenge.