?
Solved

Pass value to window using VBA in Dynamics GP

Posted on 2006-07-04
12
Medium Priority
?
928 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 

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 1500 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

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