>I need to automate an importation process from an MSAccess table into a DBF table.
>
>I can open the Access table using the Connection Designer/ Remote View, but the Access Table itself could be located anywhere on the client's system, so I want to give them a user-definable path to it.
>
>Using the Connection Designer, I created a connection to the MSACCESS table in the project manager as "CONNECT1".
>I then created a remote view based on that connection, called "MSACCESS1"
>
>My problem is I don't know how to automate it to 'access' this Access table without bringing up another VFP automatic browse box, looking for the Access table.
>Is the above the best/only way to import from Access (not sure which version).
>
>Ideally I would like to be able to say...
>
>USE MSACCESS1 with "*path+filename of Access table*"
>
>Can I do something like this in VFP6/SP5?
>
>Thanks in advance,
>
> -Kevin.
Try this exmple
constring = "DBQ=f:\...\yourname.mdb;Driver={Driver do Microsoft Access (*.mdb)};DriverId=25;FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8"
sqlHandler = SQLSTRINGCONNECT(constring)
IF sqlhandler < 1
AERROR(arr)
MESSAGEBOX(arr[1,2])
MESSAGEBOX("No connection")
RETURN .f.
ENDIF
TEXT TO sqlSelect NOSHOW ...
SELECT ... FROM MsAccessTable ... WHERE...
ENDTEXT
IF SQLEXEC(sqlHandler,sqlselect,"MyCursor") <0
MESSAGEBOX("Error...")
AERROR(arr)
MESSAGEBOX(arr[1,2])
RETURN .f.
ENDIF
BROWSE NORMAL
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst