- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Call click event of a button from another sub
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-02-2011 02:38 PM
Hi,
I am new to customization and am trying to run a check prior to allowing a user to run an existing standard MAS 500 button. Since you cannot customize a normal button, I was thinking of doing the following:
0. Lets call the exisitng button buttonStandard and a new button buttonNew
1. Put buttonNew over buttonStandard
2. In the sub buttonNew_Click:
a. run required check
b. if successful call buttonStandard_Click or Forms("buttonStandard").click or something similar (not sure how to do this)
c. if a. was not successful, raise error and return
Does anyone know how this can be accomplished?
Regards,
Keith
Re: Call click event of a button from another sub
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-02-2011 04:02 PM
What you ask for is not available using Customizer today. A VB button Click sub routine as well as any subroutine or function within the MAS 500 Visual Basic code is not accessible from a VB script created by Customizer. Why you may ask? Well the current version of Customizer was never intended to do hard core modifications to MAS 500. That's what the SDK was created for. Customizer's original intent was to allow users to customize the look and feel of screens, add security to these modifications and create simple vbScripts to do small things from within Customizer.
However, along came a few savvy users knowledgable in vbScript and the capabilities it had which pushed the bounds of what Customizer was originally designed for. Sage has acknowledged this power user community and is in work on the next generation of Customizer which may or may have this functionality. Maybe someone from Sage could give us a sneak peek of what to expect.
For your scenario since you want to do a check, see if the Form_Save event available from within Customizer could be used for this. I believe there is a thread on this site with some techniques on how to keep the form from saving if your check fails.. Hopefully, those who know this technique will post the information here on how to do it.
e2b teknologies, inc
www.e2btek.com
Re: Call click event of a button from another sub
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-12-2011 10:10 AM
I have done something similar to that.
I have a button that opens the window to create Work Orders, but I want to check if a work order already exists for that sales order line.
What I did was hide the original "Create WO" button and created my custom one.
On this custom button (also called Create WO) I do the verification I need, and it passes I call the original "Create WO" button.
Here is the code that I used:
Sub cmdCreateWO_SPI_Click()
Dim btnCWO
btnCWO = Form.Controls("cmdCreateWO")
Dim btnOWO
btnOWO = Form.Controls("cmdOpenWO")
If (btnOWO.enabled) Then
MsgBox("A WO already exists for this SO Line!")
End If
If (btnCWO.enabled) Then
btnCWO.SetFocus()
'Call Enter (BIG Gambiarra)
Dim sh
Set sh = CreateObject("WScript.Shell")
sh.AppActivate("Enter Sales Orders and Quotes*")
sh.SendKeys("{ENTER}")
Set sh = Nothing
End If
End SubMy workaround is that I set focus on the button, and then I hit "ENTER" to call the button. There are better ways to call the button, but I still have to find the example.
See if that helps!
Re: Call click event of a button from another sub
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-20-2012 12:10 PM
I've heard it's possible to do what you want by setting the original button's "Value" property to "True", but that doesn't seem to be working on my system.
Technology Consultant
SGS Technology Group
http://www.sgstech.com


