Too few parameters error BUT only after the code has gone through MANY iterations

  • Thread starter Thread starter CPutnam
  • Start date Start date
C

CPutnam

I've read a lot of information on the "Too few parameters.." error but
nothing seems to be addressing the problem I'm having.

Here's the code that I think is causing the problems:

If IsNull(DFirst(strOrgKeyField, rst!OrgKeyTableName, _
strRelKeyField & "='" & rstTbl.Fields(rst!IFMSIDName) & "'
AND " & strOrgKeyField & "='" & rstTbl!OWNERDATABASE & "'")) Then
dbs.Execute "INSERT INTO tblTEMPNoOrgOwnerVBACalc
(TableName, IFMSID, Owner) " & _
"VALUES ('" & rst!CLSTableName & "', '" &
rstTbl.Fields(rst!IFMSIDName) & "', '" & rstTbl!OWNERDATABASE & "');"

BUT I don't get the error until the code has been gone through many many
times (I stepped through the code to make sure that it was working correctly
and that I was reaching these lines). The table(s) I'm working with were
created from external text files. Both fields in the tables
(rstTbl.Fields(rst!IFMSIDName & rstTbl!Ownerdatabase) are Text fields.

I have my status bar set up to show me the record that's being processed and
if I delete the record from the table, the process goes through more records
until it bombs again. I can see no difference in the data between the
problem record and the other records.

So my question is why would a function that was working fine all of a sudden
give an error? Thanks in advance. Carol.
 
I've been working on this and found something else strange. I removed the
table that appeared to be causing all the errors so the code doesn't look at
that table at all.

But then the "Too few parameters" error shows up for a record that had
successfully passed through the code in earlier runs.

I am totally mixed up. Thanks again for any help. Carol.
 
Back
Top