Modify sql statement

R

Rod

Hello,

I and doing an archive and would like to make a simple change but can't
figure it out. Here is the code:

'Step 1: Initialize database object inside a transaction.
Set ws = DBEngine(0)
ws.BeginTrans
bInTrans = True
Set db = ws(0)

'Step 2: Execute the append.
strSql = "INSERT INTO tblCandidatesArchive "
strSql = strSql & " IN 'J:\Bak\PFS\Recruiting\MyCandidateArchiveTable.mdb' "
strSql = strSql & " SELECT * FROM tblCandidates"
strSql = strSql & " WHERE Archive <= #" & Date & "#;"

db.Execute strSql ', dbFailOnError

'Step 3: Execute the delete.
strSql = "DELETE FROM tblCandidates"
strSql = strSql & " WHERE Archive <= #" & Date & "#;"
db.Execute strSql ', dbFailOnError

I would like to change the WHERE statements to not only check the date but
if CALL_RESULTS = Skipped then archive that record as well.

Thanks.
 
D

Dorian

strSql = "INSERT INTO tblCandidatesArchive "
strSql = strSql & " IN 'J:\Bak\PFS\Recruiting\MyCandidateArchiveTable.mdb' "
strSql = strSql & " SELECT * FROM tblCandidates"
strSql = strSql & " WHERE Archive <= #" & Date & "#" & _
OR CALL_RESULTS = 'Skipped';"
strSql = "DELETE FROM tblCandidates"
strSql = strSql & " WHERE Archive <= #" & Date & "#" & _
OR CALL_RESULTS = 'Skipped';"

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
R

Rod

Thanks much!

Dorian said:
OR CALL_RESULTS = 'Skipped';"

OR CALL_RESULTS = 'Skipped';"

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top