Information générale
Catégorie:
COM/DCOM et OLE Automation
Vin,
I guess I wanted to do it the hard way. I have created a class that creates an Access database, creates the table and inserts the VFP-data directly into the Access table. I use the transferdatabase method to make it happen.
The syntax took a while to figure out but it works like a charm now.
Thanks for the hint,
Ron Brahma
>>>>>>>>>>>>>>>>>>>>>>>>>>>
>In one of my VFP applications I want to move data from VFP to Access.
>I have found out how to get the data into Access but only as a linked table. I do this with the following source:
>oAccess = CreateObject("Access.Application")
>oAccess.newcurrentdatabase(pcCopyTo)
>oDb = oAccess.CurrentDb
>oTable = oDb.CreateTableDef(pcCopyFile)
>
>* Link
>oTable.Connect = "DBase IV;DATABASE=" + pcCopyFrom
>oTable.SourceTableName= pcCopyFile+ '.dbf'
>oDb.TableDefs.Append(oTable)
>
>This works quite nicely but it only links the table. I want to import it into Access. Going through the help-files has brought me nowhere. Can anyone tell me how this can be done?
>
>Any help is appreciated.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
>If I understand correctly, I believe that the TransferDatabase command in Access is what you are looking for. I can't recall whether it accepts a parameter for what kind of file you are transferring (dBase, etc.) but it may give you a start. (urggghh - this sort of thing really is harder through Access thatn it should be -- but that's just a side note.)
>
>You could also set up the Access data structures, then use remote views via ODBC -- import from Table A (native VFP table) to view A (view against the Access Database). This will be helpful if you want to log along the way how many records were brought in, or take any pre-processing action against the data (change names to Propert, etc.)
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement