Solved

Pass value to window using VBA in Dynamics GP

Posted on 2006-07-04
12
905 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SAP Query from a URL? 3 105
Steps to architect a software solution 4 78
OMS agent on Windows 2012 X64 5 167
Customer Satisfaction Survey Tool/Software 1 418
If you have problems displaying reports in CRM after a new installation, review the following steps: Check that SQL Server Reporting Services is working On the server that has SQL Server Reporting Services (SQL SRS) installed, check that the S…
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…

733 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