I am having a large sql query running more than 6500 characters. I want to give only one Button to save in database. I want to fire other button when one click on the visible button. Other button would remain invisible. How to trigger the when Changed of other button when a visible button is clicked?
If you want to create a button click event with a property.
Please use this formula to ensure that the button has been clicked
If Value Is Nothing AndAlso OldValue Is Nothing Then 'button is clicked 'Place your code here End If
I got that from the nuggets.
Christian, the code that you found in nuggets is correct but it is meant as a guideline on how to put code inside a whenchanged formula that is intended to be tied to a button. If you do not enclose the code within that 'IF' block, RS wouldn't know the difference between when the button was clicked vs. if the value of the property changed - i.e. the code in whenchanged formula would execute even if the button was not clicked and that is not desirable.
What the original question is asking (I think) is to have code in 2 different WhenChanged formulas but have only one button to do that. While you can do this in a couple of different ways (I've never had the need to do it yet), what you could also do is tie the button to a custom.vb function (like Yuri suggested). My personal inclination is to avoid custom.vb as much as possible so what I would do in this case is build the SQL statement (using more than one properties if the character count is over 6500) and just execute the code in WhenChanged (rather than building the SQL in there as well).