Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 he 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 Pivot Table from a Paradox File | Excel Discussion (Misc queries) | |||
PASTE LINK option not available when I select PASTE SPECIAL to link an image in Excel to a Word document. | Links and Linking in Excel | |||
data from Paradox to Excel | Setting up and Configuration of Excel | |||
import paradox database into excel | Excel Discussion (Misc queries) | |||
Paradox then paste into excel | Excel Programming |