Microsoft Access - Only Save Form Changes With A Save Button

Поділитися
Вставка
  • Опубліковано 1 лют 2025

КОМЕНТАРІ • 27

  • @goverdhanjayaram3683
    @goverdhanjayaram3683 17 днів тому

    Excellent Solution !!! Thank you very much !

    • @DanielPineault
      @DanielPineault  17 днів тому

      My pleasure. Glad you found the video helpful.

  • @horatiurotar6257
    @horatiurotar6257 10 місяців тому

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

  • @ralphlewis4350
    @ralphlewis4350 5 місяців тому

    Awesome and well explained Thankyou

  • @janvanantwerp6574
    @janvanantwerp6574 11 місяців тому

    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  11 місяців тому

      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/

  • @hassanrozh6579
    @hassanrozh6579 11 місяців тому

    Easy way but great idea, thanks so much.

  • @JosephOwino-jf2oj
    @JosephOwino-jf2oj 11 місяців тому

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

    • @DanielPineault
      @DanielPineault  11 місяців тому +1

      This approach works for continuous forms.

  • @akokohjoel9854
    @akokohjoel9854 11 місяців тому

    You teach with simplicity

    • @DanielPineault
      @DanielPineault  11 місяців тому

      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.

  • @xavierbatlle1828
    @xavierbatlle1828 11 місяців тому

    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

  • @abdulhamidalhaddadi2255
    @abdulhamidalhaddadi2255 9 місяців тому

    Thank you

  • @SAMYTAHER
    @SAMYTAHER 11 місяців тому

    👍🏻👍🏻👍🏻

  • @neojumpy
    @neojumpy 11 місяців тому

    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  11 місяців тому

      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 11 місяців тому

      @@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  11 місяців тому

      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 11 місяців тому

      @@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 8 місяців тому

      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.