Too few parameters. Expected 1

L

Lezzo

I have the following lines of code in a function.

Dim db As Database, rs As Recordset, strBody As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT * FROM tblinvoices
WHERE [RecordID] = " & Forms!frmPrepLetter!LogNum)

The routine halts at the last line where with the
following error message: Too few parameters. Expected 1.

Does anyone sees what I'm doing wrong here?

TIA.
 
C

CSmith

Hi,

If RecordID is text, then surround the LogNum value by single quotes.

Example:

[RecordID] = ' " & Forms!frmPrepLetter!LogNum & " ' "
 
C

Chris

If that didn't fix it, that error is usually caused by
misspelling a field name. Make sure that the field is in
fact RecordId.

Chris
 

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

Top