Solved

Pass value to window using VBA in Dynamics GP

Posted on 2006-07-04
12
874 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
 

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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When CRM stops functioning propperly or mysteriously disappears then this is something you should always check. This can be useful when looking at an end users machine or your own machine if you are the end user. It may be fairly obvious to some but…
Messaging apps are amazing tools with the power to do a lot of good, but the truth is the process of collaborating with coworkers requires relationships established through meaningful communication - the kind of communication that only happens face-…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now