How to... Start DMAP from a Database or Spreadsheet


General Principle

The exporting of data from a database or spreadsheet is referred to in the topic How to... Export Distribution Data to DMAP from a Database or Spreadsheet. After exporting the Distribution Data, DMAP can be started in the standard way by clicking its Icon or from the Windows Start Menu. An alternative to this is to start DMAP from the database or spreadsheet itself, giving a more 'seamless' link to DMAP.

The details of exactly how to start DMAP from a particular Database or Spreadsheet program will depend on the particular software being used. The general principle is very simple, but you will need to be a little bit familiar with the underlying program language used for writing Macros or Modules within that software. The general principle is that you should firstly call a function or procedure which changes the current path to that of the Dmapw directory and then call a function or procedure which launches the DMAP program (Dmapw.exe). The reason for firstly changing the current path is that DMAP looks for some of its data files in the Dmapw directory. The example given below illustrates the sort of Visual Basic code which is needed for Microsoft Access and Microsoft Excel.


Some detail for Microsoft Access and Microsoft Excel

The Visual Basic code needed for launching DMAP is given below:

ChDir "c:\dmapw"
Shell ("c:\dmapw\dmapw.exe")

The code itself can be put in a Macro or Module of its own, or it could be included at the end of a longer Macro which first exports the Distribution Data to DMAP. The Macro or Module can either be run from the appropriate Menu item, or it could be installed as a routine which acts in response to clicking a Button on a Form.

With the simple code given above, when you return to the database or spreadsheet the current path will remain at the Dmapw directory. The modified code given below will preserve the original path:

Dim OldPath As String
OldPath = CurDir()
ChDir "c:\dmapw"
Shell ("c:\dmapw\dmapw.exe")
ChDir OldPath


If you have any comments, suggestions or queries about this procedure, Contact Alan Morton


Home Page