• SQLRequest (Excel 2000/SR1)

    Author
    Topic
    #364837

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #561558

      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

    • #561559

      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.

    Viewing 1 reply thread
    Reply To: SQLRequest (Excel 2000/SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: