Solved

Pass value to window using VBA in Dynamics GP

Posted on 2006-07-04
12
887 Views
Last Modified: 2013-11-23
I need to pass the customer ID on the Sales Transaction Entry window to the Item lookukp (using the line item grid) on the SOP Transaction Entry window so I can only show the Inventory Items associated wtih the customer picked on the invoice.

The goal is to only show a certain set of items for sale to a customer.  Each customer has their own items and should only be sold those items.
0
Comment
Question by:pmasseycpa
  • 7
  • 5
12 Comments
 
LVL 3

Expert Comment

by:DennisL
ID: 17037714
Add the Sales Transaction Entry window and the customer ID to VBA.

If your Lookup form is not a part of the Great Plains product (in VBA), you will need to create a reference to the Great Plains product.

From there you should be able to access the Customer ID from the Sales Transaction Entry window.



Just remember that the Item lookup can be called from multiple spots, so you will want to verify that the Sales Transaction Entry window is the one that opened the Item Lookup.
0
 

Author Comment

by:pmasseycpa
ID: 17037738
Can you give me an idea of what the code should look like?  I have the GP reference in the Smartlist Item Lookup window.
0
 
LVL 3

Expert Comment

by:DennisL
ID: 17037758
to reference the customer ID, just use the variable

GreatPlains.SalesTransactionEntry.CustomerID

(It might be a little off, but that's the general idea, I don't have vba running at the moment)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:pmasseycpa
ID: 17037779
Actually, I have it.  Do you have any idea how to set it so it only activates this code if you are coming off the SOP window?
0
 

Author Comment

by:pmasseycpa
ID: 17037811
Actually, I don't have it...  The code below does nothing other than set the window to show the Customer Items by default.  It does not restrict to showing only the customer selected...

Private Sub Window_AfterActivate()
    ViewAllItemNumbersbyItemNumber = 2
    Items.CustomerNumber = SalesTransactionEntry.CustomerID
End Sub
0
 
LVL 3

Expert Comment

by:DennisL
ID: 17037817
Plenty of ways, if you have access/knowledge of the Dexterity Development environment, I highly suggest that route.

But many people use VBA for this.  On the Lookup button in the sales transaction entry scrolling window, add a script that sets a global variable.  Then when you run your filter code on the lookup window, check that global variable.  
0
 
LVL 3

Expert Comment

by:DennisL
ID: 17037841
Forgot to mention, you will need modifier to get access to the lookup button in hte scrolling window.

Add the window to modifier, then in modifier.
 find the lookup button, it will be invisible.  Make it visible and you should be able to add it to VBA.
0
 

Author Comment

by:pmasseycpa
ID: 17039887
Actually, I don't have it...  The code below does nothing other than set the window to show the Customer Items by default.  It does not restrict to showing only the customer selected...

Private Sub Window_AfterActivate()
    ViewAllItemNumbersbyItemNumber = 2
    Items.CustomerNumber = SalesTransactionEntry.CustomerID
End Sub
0
 
LVL 3

Expert Comment

by:DennisL
ID: 17042303
What version of GP are you running?
0
 

Author Comment

by:pmasseycpa
ID: 17043380
9.0 with SP 1
0
 
LVL 3

Expert Comment

by:DennisL
ID: 17047815
Don't have access to GP right now so bear with me.  

Add the scrolling window to VBA.

I can't remember the event for the scrolling window but one of them has a Hide or show parameter.  

Simply add code in that event...

if <scrollingwindow>.CustomerID <> SalesTransactionEntry.CustomerID then
  Show = false
end if
0
 
LVL 3

Accepted Solution

by:
DennisL earned 500 total points
ID: 17053885
Now that I've looked at it.  If you have already added the Items window, the scrolling window should be in there already under the name ItemsDetail.  The ItemsDetail will have an object named Grid which will have the event BeforeLinePopulate.  

Private Sub Grid_BeforeLinePopulate(RejectLine As Boolean)

End Sub

If you set RejectLine to true, it will reject the current line.  This event is fired everytime a line is displayed in the window.


Now there's another problem, the Item list won't display the Customer ID.  You will need to use ADO or some other way to access the database to check the Customer Item table to see if the Item is assigned to the Customer.

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: You must have administrative privileges in order to configure lead or case queues. Salesforce.com (http://www.Salesforce.com) is a cloud-based customer relationship management (CRM) system. It is widely used around the world by sales and ma…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question