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
6 ай бұрын
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
6 ай бұрын
You teach with simplicity
@DanielPineault
6 ай бұрын
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
6 ай бұрын
Easy way but great idea, thanks so much.
@DanielPineault
6 ай бұрын
Always a pleasure.
@abdulhamidalhaddadi2255
4 ай бұрын
Thank you
@DanielPineault
4 ай бұрын
My pleasure.
@xavierbatlle1828
6 ай бұрын
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
@DanielPineault
6 ай бұрын
👍
@JosephOwino-jf2oj
6 ай бұрын
Thanks for this. Do you also have a workaround for continous forms?
@DanielPineault
6 ай бұрын
This approach works for continuous forms.
@SAMYTAHER
6 ай бұрын
👍🏻👍🏻👍🏻
@DanielPineault
6 ай бұрын
Thank you.
@neojumpy
6 ай бұрын
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
6 ай бұрын
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
6 ай бұрын
@@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
6 ай бұрын
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
6 ай бұрын
@@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
3 ай бұрын
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.
Пікірлер: 25