Discussion:
Return value from GP Lookup using Pass Through Sanscript and VBA
(too old to reply)
jalpha21
2009-04-13 23:29:02 UTC
Permalink
Code snippet:

Set CompilerApp = CreateObject("Dynamics.Application")
Commands = ""
Commands = Commands & "open form IV_Location_Lookup {return to CUSTOMER
FIELD}; {Can't return to Modifier field}"
Commands = Commands & "run script 'Redisplay Button' of window
IV_Location_Lookup of form IV_Location_Lookup;"
' Execute SanScript call OpenWindowRet of form IV_Location_Lookup, """ &
Trim(FMSSiteID) & """, """ & Trim(FMSSiteID) & """
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)

I created a lookup button using the Modifier and attached some VBA code to
open the Site ID lookup. That works great, but how do I return the Site ID
selection from the Microsoft Dynamics GP lookup window to my Modifier/VBA
added Site ID field to the Customer Maintenance window?

Thanks.

Jeff
Mariano Gomez
2009-04-14 01:22:01 UTC
Permalink
Take a look at the technique I show in the 3-day workshop material at
http://dynamicsgpblogster.blogspot.com/2009/02/this-week-free-visual-basic-for.html.
You can jump straight to the code (day 3) or you can browse the entire
workshop for a comprehensive idea on many of the techniques exposed.

Best regards,
--
MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com
The Dynamics GP Blogster at http://dynamicsgpblogster.blogspot.com
Post by jalpha21
Set CompilerApp = CreateObject("Dynamics.Application")
Commands = ""
Commands = Commands & "open form IV_Location_Lookup {return to CUSTOMER
FIELD}; {Can't return to Modifier field}"
Commands = Commands & "run script 'Redisplay Button' of window
IV_Location_Lookup of form IV_Location_Lookup;"
' Execute SanScript call OpenWindowRet of form IV_Location_Lookup, """ &
Trim(FMSSiteID) & """, """ & Trim(FMSSiteID) & """
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
I created a lookup button using the Modifier and attached some VBA code to
open the Site ID lookup. That works great, but how do I return the Site ID
selection from the Microsoft Dynamics GP lookup window to my Modifier/VBA
added Site ID field to the Customer Maintenance window?
Thanks.
Jeff
jalpha21
2009-04-14 20:52:02 UTC
Permalink
Hi Mariano,

Thank you for the response. I actually viewed your technique first before
entering this blog entry. You have great material.

I attempted to implement your code to work for me, but I don't have Field
Service loaded and your window and product calls were confusing me.

Here is my situation and code snippet. Hopefully, you can help me with the
right calls to the right windows since I don't have Field Service to look at
as an example - which window is which.

This code is on the Sites window - SmartList Product

I am trying to open the Sites Lookup - Microsoft GP Product from the
Customer Maintenance window - Microsoft GP Product. I need to return my
Sites value to a new field on the Customer Maintenance window - MS GP
Product. Your code and sample mentions SmartList, so I placed my code on
that window - Sites (SmartList)

Jeff's Code:

Option Explicit

Dim LinkedSiteLookup As Boolean

Private Sub Window_BeforeOpen(OpenVisible As Boolean)
LinkedSiteLookup = Microsoft_Dynamics_GP.Sites.LinkedSiteLookup
End Sub

Private Sub Select_AfterUserChanged()
If LinkedSiteLookup Then
If Microsoft_Dynamics_GP.CustomerMaintenance.IsLoaded Then
Call
Microsoft_Dynamics_GP.ReturnFMSSiteID(SitesDetail.LocationCode)
End If
End If
LinkedSiteLookup = False
End Sub

Mariano's sample:

Window_BeforeOpen

' Created by Mariano Gomez, MVPPrivate Sub Window_BeforeOpen(OpenVisible As
Boolean) LinkedCustomerLookup =
FieldService.EquipmentMaintenance.LinkedCustomerLookup
End Sub

Select_AfterUserChanged

' Created by Mariano Gomez, MVPPrivate Sub Select_AfterUserChanged()
If LinkedCustomerLookup Then
If FieldService.EquipmentMaintenance.IsLoaded Then
Call
FieldService.EquipmentMaintenance.ReturnRegulatoryAgency(DebtorsandProspectsDetail.CustomerNumber)
End If
End If
LinkedCustomerLookup = False
End Sub
Post by Mariano Gomez
Take a look at the technique I show in the 3-day workshop material at
http://dynamicsgpblogster.blogspot.com/2009/02/this-week-free-visual-basic-for.html.
You can jump straight to the code (day 3) or you can browse the entire
workshop for a comprehensive idea on many of the techniques exposed.
Best regards,
--
MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com
The Dynamics GP Blogster at http://dynamicsgpblogster.blogspot.com
Post by jalpha21
Set CompilerApp = CreateObject("Dynamics.Application")
Commands = ""
Commands = Commands & "open form IV_Location_Lookup {return to CUSTOMER
FIELD}; {Can't return to Modifier field}"
Commands = Commands & "run script 'Redisplay Button' of window
IV_Location_Lookup of form IV_Location_Lookup;"
' Execute SanScript call OpenWindowRet of form IV_Location_Lookup, """ &
Trim(FMSSiteID) & """, """ & Trim(FMSSiteID) & """
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
I created a lookup button using the Modifier and attached some VBA code to
open the Site ID lookup. That works great, but how do I return the Site ID
selection from the Microsoft Dynamics GP lookup window to my Modifier/VBA
added Site ID field to the Customer Maintenance window?
Thanks.
Jeff
David Musgrave [MSFT]
2009-04-16 03:55:46 UTC
Permalink
Hi

Have a look at blog articles which discuss how to access a modified field via pass through sanScript.

http://blogs.msdn.com/developingfordynamicsgp/archive/2008/07/24/hybrid-dynamically-populating-a-modifier-added-list.aspx

http://blogs.msdn.com/developingfordynamicsgp/archive/2008/07/11/microsoft-dynamics-gp-technical-airlift-2008.aspx

David Musgrave [MSFT]
Escalation Engineer - Microsoft Dynamics GP
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)
http://www.microsoft.com/Dynamics

mailto:***@online.microsoft.com
http://blogs.msdn.com/DevelopingForDynamicsGP

Any views contained within are my personal views and not necessarily Microsoft policy.
This posting is provided "AS IS" with no warranties, and confers no rights.
Vaidy
2009-04-15 05:17:01 UTC
Permalink
Hi Jeff,

Have a look at the article,
http://www.vaidy-dyngp.com/2009/02/vba-continuum-finetuned-dropdown-list.html.

While this article does not address your immediate requirement, it does
explain what needs to be done if you want to access a Field added to a GP
Form using Modifier. You can import the package from the download link
provided and check the code to know better.

I strongly recommend you to take a look at David Musgrave's article (which I
have mentioned on the same article), to know the concept.

Hope that helps.
--
Thanks
Vaidy
http://www.vaidy-dyngp.com
Post by jalpha21
Set CompilerApp = CreateObject("Dynamics.Application")
Commands = ""
Commands = Commands & "open form IV_Location_Lookup {return to CUSTOMER
FIELD}; {Can't return to Modifier field}"
Commands = Commands & "run script 'Redisplay Button' of window
IV_Location_Lookup of form IV_Location_Lookup;"
' Execute SanScript call OpenWindowRet of form IV_Location_Lookup, """ &
Trim(FMSSiteID) & """, """ & Trim(FMSSiteID) & """
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)
I created a lookup button using the Modifier and attached some VBA code to
open the Site ID lookup. That works great, but how do I return the Site ID
selection from the Microsoft Dynamics GP lookup window to my Modifier/VBA
added Site ID field to the Customer Maintenance window?
Thanks.
Jeff
Loading...