MSQUERY: Undocumented DDE Request Items TierType and FileExt

ID: Q123328

1.00 2.00 97 WINDOWS kbtool kbinterop

The information in this article applies to:

SUMMARY

In Microsoft Query, there are two available dynamic data exchange (DDE) request items that are not documented. The TierType request item and the FileExt request item are both available on the system channel.

NOTE: Unlike earlier versions, online Help for Microsoft Query 97 documents the TierType request item but does not document the FileExt request item.

MORE INFORMATION

The following describes TierType and FileExt and the information returned by each item:

TierType[/source]: This item returns the type of the specified data source.

                   If no source is specified, the default data source
                   type is returned. If no source is specified, and there
                   is no source currently connected, Microsoft Query tries
                   to connect to that source. Return values are:

                      1 = Single Tier
                      2 = 1.5 Tier (Access 1.1, Btrieve)
                      3 = Multiple Tier (SQL Server, Oracle, Access 2.0)

FileExt[/source]: For single tier data sources, this item returns the file
                   extension for the specified data source. As with
                   TierType, if no source is specified, the file extension
                   for the default data source is returned. If no source is
                   specified, and there is no source that is currently
                   logged on, Microsoft Query tries to connect to that
                   source.

For example, if you request the FileExt item and you specify a dBASE data source, the value "dbf" is returned. If you specify a Text data source, both the values "txt" and "csv" are returned.

Note that the FileExt request item only returns a value for a single tier type data source (not 1.5 tiers).

Visual Basic Example

In the following example, the TierType request item is assigned to the variable tier_type, and returns the value 1 in a message box. The FileExt request item is assigned to the variable file_ext and returns the value dbf in cell A1 on Sheet1 in the active workbook. Note that Microsoft Query must be running, or the Microsoft Query directory must be listed in the path statement in your AUTOEXEC.BAT file to avoid receiving an error message when you run the following procedure.

Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft Support professionals can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

Sub Run_Query()

   ' Dimension variables used
   Dim chan As Integer, sql As String
   Dim tier_type As Variant, file_ext As Variant

   ' Define sql statement
   sql = _
       "[open('SELECT customer.CUSTMR_ID FROM C:\win31\data\customer.dbf']"

   ' Establish DDE channel with Microsoft Query
   chan = DDEInitiate("MSQUERY", "System")

   ' Logon using dBase4 data source
   DDEExecute chan, "[Logon('dBase4')]"

   ' Run SQL statement
   DDEExecute chan, sql

   ' Request TierType item
   tier_type = DDERequest(chan, "TierType")
   MsgBox tier_type(1)

   'Request FileExt item
   file_ext = DDERequest(chan, "FileExt")
   Sheets("Sheet1").Range("A1").FormulaR1C1 = file_ext

   ' Terminate DDE channel
   DDETerminate chan

End Sub

REFERENCES

Microsoft Query 97

For more information about using DDE with Microsoft Query 97, click the Index tab in Microsoft Excel Help, type the following text

   dde

and then double-click the selected text to go to the "Use Dynamic Data Exchange (DDE) with Microsoft Query" topic.

Microsoft Query 1.0 and 2.0

"Microsoft Query User's Guide," Chapter 9, "Using Dynamic Data Exchange with Microsoft Query"

For more information about a specific DDE command to use with Microsoft Query 1.0 and 2.0, click Contents on the Help menu and click the topic DDE Commands.

Additional reference words: 1.00 2.00 5.00 5.00c 7.00 7.00a 8.0 8.00

Keywords          : kbinterop xlvbainfo xlquery 
Version           : 1.00 2.00 97
Platform          : WINDOWS

Last Reviewed: May 19, 1999