Microsoft Access - Only Save Form Changes With A Save Button

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 พ.ย. 2024

ความคิดเห็น • 25

  • @horatiurotar6257
    @horatiurotar6257 7 หลายเดือนก่อน

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

  • @ralphlewis4350
    @ralphlewis4350 2 หลายเดือนก่อน

    Awesome and well explained Thankyou

  • @janvanantwerp6574
    @janvanantwerp6574 8 หลายเดือนก่อน

    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  8 หลายเดือนก่อน

      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 8 หลายเดือนก่อน

    Easy way but great idea, thanks so much.

  • @JosephOwino-jf2oj
    @JosephOwino-jf2oj 8 หลายเดือนก่อน

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

    • @DanielPineault
      @DanielPineault  8 หลายเดือนก่อน +1

      This approach works for continuous forms.

  • @akokohjoel9854
    @akokohjoel9854 7 หลายเดือนก่อน

    You teach with simplicity

    • @DanielPineault
      @DanielPineault  7 หลายเดือนก่อน

      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.

  • @abdulhamidalhaddadi2255
    @abdulhamidalhaddadi2255 6 หลายเดือนก่อน

    Thank you

  • @xavierbatlle1828
    @xavierbatlle1828 8 หลายเดือนก่อน

    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 8 หลายเดือนก่อน

    👍🏻👍🏻👍🏻

  • @neojumpy
    @neojumpy 8 หลายเดือนก่อน

    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  8 หลายเดือนก่อน

      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 8 หลายเดือนก่อน

      @@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  8 หลายเดือนก่อน

      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 8 หลายเดือนก่อน

      @@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 5 หลายเดือนก่อน

      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.