Hello All I have created a new table that holds [no.] from table resource and two fields that are Technical and Commercial approver codes that links in with Salesperson/Purchaser table. When pressing a command button I need to refer to a new function within OnPush and then use this to send an automatic email to all relevant email address for the Technical approver. The new table that holds the approvers looks like: Resource No. Tech App Comm App RES0000028 DW TL RES0000028 TL GB RES0000028 DW GB Therefore, within the function, I want to ensure that I check through the table for RES0000028 for example and send an email to DW and TL once each i.e. Not two emails to DW. The code I have generated is as follows, but its not working… Is there a glaring mistake or I have I approached this the wrong way? LResourceSalesperson is the new table. LSalespersonEmail is the Salesperson/Purchaser table. LResourceSalesperson.SETRANGE(“No._FK”, ResourceType); LResourceSalesperson.FIND(’-’); REPEAT IF TechApproverCode <> LResourceSalesperson.TechApprover THEN TechApproverCode := LResourceSalesperson.TechApprover; LSalespersonEmail.SETRANGE(Code, TechApproverCode); LSalespersonEmail.FIND(’-’); TechApproverEmail := LSalespersonEmail.“E-Mail”; LcduMail.NewMessage(‘TechApproverEmail’,’’,‘Quote raised - Waiting for Technical Approval’,“No.”,’’,FALSE); UNTIL LResourceSalesperson.NEXT = 0; Any advice would be most appreciated. Thanks.
Hi Please quote your piece of code with [ code ] and [ /code ] (without spaces). The send - command is missing in your case. And I think (not sure) you have to use real mail- addresees instead of a variable. II. Edit: If you can use a variable then only without the quotation marks. LcduMail.NewMessage('TechApproverEmail','','Quote raised - Waiting for Technical Approval',"No.",'',FALSE); LcduMail.send;
bye André
Hi Andre I will remember to quote the code better in the future. I have tried the LcduMail.Send but no emails have been sent. Does my code look ok? David
Hi Andre I will remember to quote the code better in the future. I have tried the LcduMail.Send but no emails have been sent. Does my code look ok? David
Hi David Please try it with a real (your own) email address. As I said I’m not sure about the address- variable. IMHO the rest of the code seems OK (if the find-command can find a record [;)]). bye André
Andre, By removing ‘’ from variable TechApproverEmail, the email does go to the correct email address. So this is excellent news. The only problem is that people will receive multiple emails as it stands as my code isn’t quite working to remove this problem. I will keep working on it. Thanks for your posts.