Hi, I’m bumping my head on the following problem: in the Purchase Line table and PO order subform two new fields have been added - “Packaging Code” and “Nr. of Packages”; there is a Packaging Code table holding some informations like weight, heigt, etc… and a Packaging Code Line with the packaging components (wood %, paper %, plastic…) when a PO line is received the user fills the Packaging code and the Nr. of packages and an other table, related to the PO line, is loaded with the packaging components and Gross Weight is calculated and updated on PO line. So far so good. Now the customer wants that, every time the Nr of packages is filled or modified by the user, a form showing the Gross Weight detail opens, allowing the user to modify some components. They don’t want a button to trigger the opening of the because they say the user might forget to use it, they want the form launch “it itself”. So the form must be launched by the OnAfterValidate trigger for the “Nr. of Packages” field, of course it can’t be run modally from there, and when it is closed the Gross Weight on the first form doesn’t get updated according to the changes made on the package lines. [:(] Don’t tell me the whole design is wrong, I know that. I’m trying to see if a solution other than throw the whole thing away and rebuild it from scraps can be found. [}:)] Any ideas? [8)] Anna
Hi Anna, The dirtiest way I can come up with, is to calculate “Gross Weight” OnTimer… /Alexander
If Your customer is afraid that the user forgets to press ctrl+N (or whatever shortcut You choose), why not do it for the user? You can use Windows Scripting Host and call the SendKeys function. Search the forum for “sendkeys” and also look here for reference http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsSendKeysClassTopic.asp Windows Scripting Host is avaliable in XP and W2k3. In older versions You need to install it. //Lars
quote:
If Your customer is afraid that the user forgets to press ctrl+N (or whatever shortcut You choose), why not do it for the user? You can use Windows Scripting Host and call the SendKeys function. Search the forum for “sendkeys” and also look here for reference
Originally posted by Lars Westman - 2005 Jul 15 : 12:56:28
Mhm… but if I call the SendKeys function from inside the OnAfterValidate trigger and the sent key launchs a form modally wouldn it be the same as if the form was called by the trigger itself? [?] Anna
What about you turn it around? Make the nr of packages field not editable, and give them a form to enter it, where they can also enter the other information? That way you can run it off the Line button, or the functions button.
quote:
What about you turn it around? Make the nr of packages field not editable, and give them a form to enter it, where they can also enter the other information? That way you can run it off the Line button, or the functions button.
Originally posted by DenSter - 2005 Jul 15 : 19:30:34
So far, they seem to have contented themselves with a not editable form which opens automatically when they enter the nr of packages, there they can see whether a change is required, go back to the Order form and push the button which will open the editable form… I don’t believe this solution will last very long before somebody begins to complain because he/she can’t change the package components in the first form, but it earned me some time. [8D] Thank you Anna
Don’t you just hate it when the customer insists on something you know isn’t going to work…
quote:
…So far so good. Now the customer wants that, every time the Nr of packages is filled or modified by the user, a form showing the Gross Weight detail opens, allowing the user to modify some components. They don’t want a button to trigger the opening of the because they say the user might forget to use it, they want the form launch “it itself”. So the form must be launched by the OnAfterValidate trigger for the “Nr. of Packages” field, of course it can’t be run modally from there, and when it is closed the Gross Weight on the first form doesn’t get updated according to the changes made on the package lines. [:(]…
Originally posted by Anna Perotti - 2005 Jul 15 : 07:16:36
If I understand this, you say the form can’t be run modally on the OnAfterValidate Trigger. This is because you have started a transaction. What happens if you Commit the record? I tried code like this on the OnAfterValidate Trigger for a test and it worked: CurrForm.SAVERECORD; COMMIT; FORM.RUNMODAL(FORM::"Sales Statistics"); CurrForm.UPDATE(FALSE);
The Currform.Update(False) will allow you to change the current record on the new form.
quote:
If I understand this, you say the form can’t be run modally on the OnAfterValidate Trigger. This is because you have started a transaction. What happens if you Commit the record?
Originally posted by chrisk - 2005 Jul 18 : 12:57:59
Indeed, what happens? Must try that! Thanks! [:D] Anna