Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jun 2001
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQLRequest (Excel 2000/SR1)

    Can anyone help me with the ODBC add-in worksheet function SQLRequest.

    I am hoping to use this to return a single-cell result from a local Access database. I am trying to avoid the use of VBA (because of my limited experience with development and trouble-shooting), and was optimistic that the SQLRequest function could help.

    Have found some documentation on the MS KB, but does not show any examples of the function or ANY of the arguments [ConnectionStr, QueryText, OutRef, DriverPrompt, ColNamesLogical].

    Any help, example or a shove in the right direction would be greatly appreciated. Thanks.

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: SQLRequest (Excel 2000/SR1)

    Hi,
    This is taken directly from the MSDN library:
    SQLRequest Function
    Description

    Don't use SQLRequest and the other ODBC functions in the Xlodbc.xla add-in; use the objects, methods, and properties in the Data Access Objects (DAO) library instead.

    SQLRequest connects to an external data source and runs a query from a worksheet, and then it returns the result of the query as an array.

    This function is contained in the Xlodbc.xla add-in (ODBC Add-In on the Macintosh). Before you use the function, you must establish a reference to the add-in by using the References command (Tools menu).

    Syntax

    SQLRequest(ConnectionStr, QueryText, OutputRef, DriverPrompt, ColNamesLogical)

    ConnectionStr Required. Supplies information
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: SQLRequest (Excel 2000/SR1)

    I nearly forgot: to use that from a worksheet rather than VBA, you would use something like the following:
    =SQLRequest("DSN=NWind;DBQ=c:msquery;FIL=dBASE4",
    "Select Custmr_id, Due_date from orders where order_amt > 100",
    C15, 2, TRUE)

    The trickiest bit will probably be determining the correct connection string.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •