Activates Microsoft Query and allows users to create, open, or edit a query as if they were running Microsoft Query as a standalone program.
This command is available only on the system channel.
Syntax
UserControl(exittext, appstate, newquery)
exittext The name of the Exit command used to exit Microsoft Query after a DDE conversation. If this argument is omitted, "Return" is used.
appstate The state of the program. Can be one of the following values.
Value | Description |
---|---|
1 | Normal |
2 | Minimized (Microsoft Windows only) |
3 | Maximized |
If this argument is omitted, the current state of Microsoft Query is used.
newquery Specifies whether the Choose Data Source dialog box is displayed when Microsoft Query is started during a DDE conversation. Can be True or False.
If newquery is True, the Choose Data Source dialog box is displayed, asking the user to select a data source. If newquery is False (the default), no dialog box is displayed and any open queries for that channel are accessible.
Remarks
User control ends when the user clicks Exit on the File menu in Windows or Quit on the File menu on the Macintosh. Microsoft Query then returns to its previous program state and returns control to the destination program.
Important Do not allow a program that includes a time-out feature to time out before user control ends.
While Microsoft Query is running under user control, any new or existing queries are opened on the same DDE channel.
Example
This example starts Microsoft Query as a maximized program and replaces the Exit command on the File menu (or the Quit command on the File menu on the Macintosh) with the Return Data to Microsoft Excel command. Then it displays the Choose Data Source dialog box.
DDEExecute chan, "[UserControl(""&Return To Excel"",3,True)]")