>Hi,
>
>Can anyone help me with a SQL query I am sending through SQLexec on an ACCESS database:
>I want the filter records that belong to employees selected. The selected set of employees is represented in a VFP cursor {SELECTED} or a comma-delimited string containing their IDs {cSelectedIDs}:
>
>nSuccess=SQLexec(nFileHandle,'select * from ACCESSTABLE where ????????','RESULT')
>
>I would like to do the equivalent either VFP for clauses:
>1. for !eof('SELECTED') && A relationship is set into SELECTED
>2. for at(EMPID,cSelectedIDs)>0
First, SQLEXEC() is sending a command to Access to be processed. Access knows nothing about the VFP environment that has sent the command and it has no way to "access" your VFP cursor. You have to do it either all in Access, or all in VFP:
- if in Access, you will probably need to build the SQL SELECT string, perhaps using an IN clause: WHERE AccessEmpIDColumn IN (literal string of values built from your cSelectedIDs memvar)
- if in VFP, you could pull all the info into a VFP cursor with SELECT *, then do another SELECT locally with the two local cursors. The first SELECT * is probably going to be inefficient, though.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up