Execute DDE commands

You can send commands to Microsoft Query using DDEExecute. Commands are specific to Microsoft Query and may or may not correspond to Microsoft Query menu commands. For example, the Open and SaveAs commands perform the same functions as equivalent menu commands in Microsoft Query, but the ODBCLogon and UserControl commands do not. For a list of the available commands, click Button image.

The DDEExecute statement has two arguments.

Argument Description
channel The DDE channel value returned by DDEInitiate.
command The command to send to Microsoft Query.

To let a user build queries in Microsoft Query, you execute the UserControl command. The following example sets My Exit Command as the Exit command on the File menu in Microsoft Windows or the Quit command on the File menu on the Macintosh.

DDEExecute Chan,"[UserControl('&My Exit Command',3,True)]"
		

The DDE channel value has been previously assigned to Chan, and the command being sent to Microsoft Query is UserControl. Notice that the UserControl command and its parameters are enclosed in double quotation marks ( " " ) and square brackets ( [ ] ).