+ Reply to Thread
Results 1 to 4 of 4

link excel to paradox

  1. #1
    chato
    Guest

    link excel to paradox

    does any body knows how can i link a paradox database from excel using macro
    code...
    i want some of the information in my data base to appear in the spreadsheet
    when whenever i want it.

    if you have any example it will be great please...


  2. #2
    K Dales
    Guest

    RE: link excel to paradox

    You can do this without having to code anything.

    Data menu, choose "Get External Data" then "New Database Query"
    From the list choose Paradox if it is there (if not check Paradox
    documentation or Paradox support site regarding how to set up ODBC driver)
    After that you should get into Microsoft Query - acts sort of like the query
    design screen in MSAccess. See help files once in there.
    When done, choose from MSQuery File menu "Return data to Microsoft Excel."
    Right-clicking on results table lets you set various properties or set up
    any parameters.

    For more info search this group on topic MSQuery.
    --
    - K Dales


    "chato" wrote:

    > does any body knows how can i link a paradox database from excel using macro
    > code...
    > i want some of the information in my data base to appear in the spreadsheet
    > when whenever i want it.
    >
    > if you have any example it will be great please...
    >


  3. #3
    chato
    Guest

    RE: link excel to paradox



    i know i can do it that way, but it is not what i need...
    because i have a spreadsheet where i want to introduce a code, so with this
    code i need the macro to make a search in tha database and then put the
    information that it found in my spreadsheet...


  4. #4
    K Dales
    Guest

    RE: link excel to paradox

    The more general approach then is to use ADO. Add "Microsoft ActiveX Data
    Objects" to your references. The basic idea is as follows - the details, of
    course, depend on exactly what you want to do:

    Sub TestADO()
    Dim MyDB as ADODB.Connection ' This will be your "link" to the paradox
    database
    Dim MyRS as ADODB.Recordset ' This will store the results of your query
    Dim CStr as String ' the connection string; specifies the database driver
    and file
    Dim SQLStr as String ' for building your SQL query

    CStr = "?" ' You would need to find the proper connection string for your
    database; consult documentation or online support (e.g. search net for
    "paradox connection string")
    Set MyDB = New ADODB.Connection
    MyDB.Open CStr ' Opens the database connection

    Set MyRS = New ADODB.Recordset ' prepare the recordset
    ' You may want to set your recordset properties here, e.g. cursor type,
    cursor location; see ADO documentation
    SQLStr = "?" ' write a query in SQL and store it in a string variable
    MyRS.Open SQLStr, MyDB ' executes the query

    While Not(MyRS.EOF) ' Loop through the result set
    ' Show the first field name and value:
    MsgBox MyRS.Fields(1).Name & ": " & MyRs.Fields(1).Value
    ' Any other fields will be referenced in the same way
    WEnd

    MyRs.Close ' Be sure to close the recordset
    MyDB.Close ' Important to close the connection!

    Set MyRs = Nothing
    Set MyDB = Nothing

    End Sub

    For specifics, the documentation for ADO can be found here:
    http://msdn.microsoft.com/library/de...Technology.asp
    --
    - K Dales


    "chato" wrote:

    >
    >
    > i know i can do it that way, but it is not what i need...
    > because i have a spreadsheet where i want to introduce a code, so with this
    > code i need the macro to make a search in tha database and then put the
    > information that it found in my spreadsheet...
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1