97-2K Linked table recordset SQL

S

Sandy Lee

I am not a programmer so this may be an easy question for you.
We have an Access DB that has records in table#1 (an internal table) to find a match on then Delete the records in table#2 (a linked table DB3). This worked with Access97 but now with Access2K we get error:
"RunTime error 3061: Too few parameters. Expected 1

Any ideas? Some of code (edited) is posted below
Thanks

Set Rst1 = dbs.OpenRecordset("OBJ2612", dbOpenTable, dbReadOnly

While Not Rst1.EOF ' <--- internal table#
FVNO = (Rst1!XBI1VNO

'*** below is linked table#2 to delete recs if match found **
strSQL = "SELECT * from DLTRFILE where XBI1VNO = '" + RstO.Fields(6).Value + "'
Set Rst2 = dbs.OpenRecordset(strSQL

While Not Rst2.EOF
Rst2.Delete
Rst2.MoveNex
Wen

Rst2.Clos
Set Rst2 = Nothin
Wen

--------------------------------------------------------
 
G

Gary Walter

Hi Sandy,

I do not have a specific clue,
but often you will get this error
when Access does not recognise
something in the SQL and so assumes
it is a parameter.

Where did "RstO" come from? Is that
a typo and you meant Rst1?

Maybe it has nothing to do with change
in version, but instead, some change in
data.

I would probably add a Debug.Print stmt
and see if your Fields(6) value has some
new, odd punctuation (in the data) that is
mucking up the SQL.

strSQL = "SELECT * from DLTRFILE where XBI1VNO = '" + Rst1.Fields(6).Value + "'"
Debug.Print strSQL

What is the last debug-printed strSQL when error occurs?

That might be one idea.

Good luck,

Gary Walter

(of course, when you changed versions you went
through and "disambigulated" DIM stmts by adding
"DAO." in front of DAO objects, although I don't
suspect this is the problem)

"Sandy Lee" wrote
I am not a programmer so this may be an easy question for you.
We have an Access DB that has records in table#1 (an internal table) to find a
match on then Delete the records in table#2 (a linked table DB3). This worked with
Access97 but now with Access2K we get error:
 

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