Home » Listing Details
Top Websites
  1. Mark Polino's DynamicAccounting.net
    Over 3700 resources listed.
  2. Developing for Dynamics GP - By David Musgrave and the MS GP Dev Support Team
    Over 700 resources listed.
  3. Mariano Gomez at The Dynamics GP Blogster
    Over 600 resources listed.
  4. Mohammad Daoud's Dynamics GP Blog
    Over 400 resources listed.
  5. Microsoft Dynamics Partner Community Blog
    Over 400 resources listed.
  6. Vaidy Mohan at Dynamics GP - Learn & Discuss
    Over 400 resources listed.
  7. Dynamics GP Help
    Over 400 resources listed.
  8. Christina Phillips, Steve Endow & Lorren Zemke at Dynamics GP Land
    Over 300 resources listed.
  9. Frank Hamelly at GP2theMax
    Over 200 resources listed.
  10. About Dynamics, Development and Life
    Over 200 resources listed.
  11. eOne Business Solutions Blog
    Over 200 resources listed.
  12. Inside Microsoft Dynamics GP Official Blog
    Over 200 resources listed.
  13. VS Tools Forum
    Over 100 resources listed.
    Your Resource for Visual Studio Tools for Dynamics GP
  14. Inside Microsoft Dynamics GP Official Blog
    Over 100 resources listed.
  15. Janakiram M.P. at DynamicsBlogger
    Over 100 resources listed.
  16. Victoria Yudin's Dynamics GP Website
    Over 100 resources listed.
    Victoria Yudin
  17. Catherine Eibner MBS Developer Evangelist
    Over 100 resources listed.
  18. Sivakumar Venkataraman at Interesting Findings & Knowledge Sharing
    Over 100 resources listed.
  19. Dynamics CPM
    Over 100 resources listed.
  20. Dynamics Small Business
    Over 100 resources listed.
  21. Belinda, The GP CSI
    Over 100 resources listed.
  22. Rose Business Solutions Blog New
    Over 100 resources listed.
  23. Microsoft Dynamics GP UK Blog
    Over 100 resources listed.
  24. Leslie Vail at Dynamics Confessor Blogspot
    99 resources listed.
  25. Michael Johnson at MBS Guru
    96 resources listed.

ID:9005
Title:RW - Accessing any SQL data from a Report Example
URL:http://blogs.msdn.com/developingfordynamicsgp/archive/2008/07/17/vba-accessing-any-sql-data-from-a-report-example.aspx
Description:

The following Report Writer and VBA example demonstrates how data from any SQL table can pulled into a report regardless of the product the table is related to.  This technique can also be used when it is not possible to create the table relationship needed to add the report in the Report Writer. It works as long as you can create a query that will uniquely select the data you need based on the data on the report or from the already linked tables.

This example is based on the Manual Payments Posting Journal and MC Manual Payments Posting Journal reports. When the report starts, it uses VBA to obtain a connection via ActiveX Data Objects (ADO) to SQL Server. This connection remains open until the report ends, when the code closes the connection.

In the body of the report the code takes the voucher number of the applied document and runs a Transact-SQL query to obtain the document number for the same document from the PM_Key_MSTR (PM00400) table.  It then populates this new value into a newly created blank string calculated field.

The example is a bit more complicated because these reports are based on temporary tables which re-use the same fields for multiple purposes.  By looking at the other fields in the temporary table (specifically the Sequence Number field) it is possible to identify which records are of the type we want to modify.  For all other records we just pass through the data (for Field2) without making any changes.

NOTE: The method of opening an ADO connection to SQL Server differs for each version. v8.00 uses the external RetrieveGlobals.dll, v9.00 use the external RetrieveGlobals9.dll and v10.00 uses the built-in UserInfoGet object.

Example code for v8.0, v9.0 & v10.0 is attached at the bottom of the article.

Please see the "Installation Instructions.txt" file in each version's archive for more information.

Category:REPORTING: Report Writer
Link Owner:
Date Added:June 17, 2010 02:12:45 AM
Number Hits:25
RatingsAverage rating: (0 votes)
Reviews

No Reviews Yet.

 
GPWindow.com

Developed and presented by
Smith & Allen Consulting, Inc.,
GP specialists since 1991.