"Wrong number of arguments ..."

  • Thread starter Thread starter Bob Howard
  • Start date Start date
B

Bob Howard

I get a compile error on the "Seek" in the following sequence using Access
2003:

Set PDB = CodeDb()
Set RFile = PDB.OpenRecordset("Usys_acgRptPrn", dbOpenTable)
RFile.Index = "PrimaryKey"
RFile.Seek "=", ActDBName, strRptName

If I remove the second key (strRptName) it compiles OK.

But the documentation says it'll take up to 13 keys.

(p.s. --- this code is part of the "On-The-Fly Printing" software package I
purchased last year and I cannot get in contact with the vendor as the
"contact" link on their web site is broken...)

Any help on this ??

Bob
 
Wierd, but I found the problem...

I changed the "Dim RFile as Recordset" statement (which was just above the
snippet I originally posted) to say "dao.Recordset" ... and now it compiles
(and works) correctly.

I'm guessing it was confused between the Dao seek and the VBA seek (which
takes only two arguments). But when I specifically say it's Dao, then that
cleared up the compiler's confusion...

WHEW!

Bob
 
It sounds like you have references to both DAO and ADO and
the ADO library is higher in the references list.

If you do not intend to use both libraries, then uncheck the
ADO reference.

Regardless of all that, your change was the correct thing to
do.
 
Sounds like you have a reference to another library which has a Recordset
object, e.g. the ADO library.

The ADO's Seek method is completely different than the DAO's Seek.
Disambiguating your declaration gives you the correct type, and then the DAO
Seek applies.
 
Correct! I moved the DAO reference to just above ADO (which I don't really
need, anyway), changed "dao.Recordset" back to "Recordset" and it all worked
fine! Thanks.... Bob
 
I'd recommend keeping the DAO. designation anyhow.

Heck, I use it in Access 97 when I only have a reference to DAO set.
 
Back
Top