>I have plowed through a lot of documentation and played around with this and can't get what I want.
>
>I have a MS Access File (.mdb) on the same machine as my VFP application.
>
>I would like to read the MS Access File and use the data from it.
>
>I have gone through The Control Panel and ODBC and created a connection so I can view the .mdb file, but I haven't figured out how to bring the data into .dbf format so I can actually use it.
>
>This has lead me to chapters on SQL, COM, DCOM, ADO and RDO. As I read this stuff it appears to be trying to extract remote data that is sometimes in .dbf format already, so I am not sure which approach I should be using.
>
>Like I would just love it if the was an APPEND FROM command that I could use as for .XLS files.
>
>Before I go far down this trail, I would just like to find out which approach is best for extracting data from a .mdb file when it is on the same machine as the .dbf file. I will then focus my reading in that direction.
>
>Thanks.
>
>Mike Smith
Mike,
Using MDB files are like using SQL server or any other via ODBC, OLEDB. ie:
ldStart = {^1996/08/01}
ldEnd = {^1996/08/31}
lcMDBDir = 'C:\Program Files\Microsoft Office\Office\samples'
lcMDBName = 'NORTHWIND.MDB'
lnConnHandle = SQLSTRINGCONNECT('DSN=MS Access Database;DBQ='+;
lcMDBDir+'\'+lcMDBName+';DefaultDir='+;
lcMDBDir+';DriverId=25;FIL=MS Access;MaxBufferSize=2048;'+;
'PageTimeout=5;UID=admin;')
lcSQL = "select * from [Orders] where [RequiredDate] between ?ldStart and ?ldEnd"
SQLExec(lnConnHandle, lcSQL, 'MyResult')
SQLDisconnect(lnConnHandle)
Select myResult
Browse
lcSQL in sample could be any SQL command, not just only select-SQL.
myResult cursor could be made updatable with little effort if you ever want to edit and send back the data.
You can use it as any other VFP cursor (almost - some commands are not allowed like adding/modifying columns with alter table). ie: You could append from this cursor (or insert into) into another.
Cetin