Solved

Pass value to window using VBA in Dynamics GP

Posted on 2006-07-04
12
871 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 3

Expert Comment

by:DennisL
Comment Utility
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
Comment Utility
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
Comment Utility
What version of GP are you running?
0
 

Author Comment

by:pmasseycpa
Comment Utility
9.0 with SP 1
0
 
LVL 3

Expert Comment

by:DennisL
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Salesforce.com’s Console is a great tool to view activities, leads, contacts, accounts and opportunities all in one screen. It is particularly effective during call blocks and working numerous activities at a time in a quick, repetitive fashion (suc…
In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

15 Experts available now in Live!

Get 1:1 Help Now