Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FoxPro and Excel
Message
De
18/03/2003 14:23:17
 
 
À
18/03/2003 13:24:32
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00766628
Message ID:
00767198
Vues:
18
>What I want to do is from Excel click a button and send maybe five pieces of data gathered from specific cells into an existing foxpro table. Can this be done with ODBC connection and sql?

Yes. Create a small VBA program that you assign to the command button.
You could use ODBC (creating a DSN in that machine) or better yet, using ADO and OleDB.

Something like this idea:
' gather info from Excel 

oConn = CREATEOBJECT("adodb.connection")
cConnString = "provider=vfpoledb;data source=mydatabase.dbc" ' or mytable.dbf
oConn.Open(cConnString)
oConn.Execute("insert into mytable (field1, field2) values (cell1, cell2)")
oConn.Close()
oConn = nothing
Of course you would have to adapt to your tables/fields and specific cells. Either all cells at once or onme record per cell, whatever applies to your sample, plus appropiate error trapping in VBA.

Alternatively you could set an OleDB Provider reference in Excel instead of doing it in code.
From the help file:
To connect to a Visual FoxPro database or table in Excel
Open an Excel worksheet. 
From the Data menu, point to Import External Data, and click Import Data. 
In the Select Data Source dialog box, click New Source Data Connection. 
In the Data Connection Wizard, select Other/Advanced. 
In the Provider tab, select Microsoft OLE DB Provider for Visual FoxPro. 
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform