Too few parameters

S

shaggles

I'm getting an error message that says 'Too few
parameters. Expected 2' when I run the following code. It
seems to be the first SQL statement that's causing the
problem but I can't figure out what is wrong with it.

On Error GoTo Err_Command23_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
If IsNull(Me!Group) Then
Set rst = db.OpenRecordset("SELECT * FROM tblResponse
INNER JOIN tblUsers " & _
"ON tblResponse.DeptID=tblUsers.DeptID " & _
"WHERE tblResponse.Issue_Num = " & Me!Issue_Num & ";")
Else
Set rst = db.OpenRecordset("SELECT
tblNotices.Issue_Num, tblUsers.Email " & _
"FROM (tblNotices INNER JOIN tblGroups ON
tblNotices.Group = tblGroups.GroupID) " & _
"INNER JOIN tblUsers ON tblGroups.UserID =
tblusers.UserID " & _
"WHERE ((tblNotices.Issue_Num = " & Me!Issue_Num & ")
AND (tblGroups.GroupID = " & Me!Group & "));")
End If
 
D

Douglas J. Steele

Make sure you don't have any typos in the table and field names.

Also, is tblResponse.Issue_Num a numeric field or text? If text, you need to
enclose the value being used in quotes:

"WHERE tblResponse.Issue_Num = '" & Me!Issue_Num & "'")

exagerated for clarity, that's

"WHERE tblResponse.Issue_Num = ' " & Me!Issue_Num & " ' ")

(The semi-colon at the end really isn't necessary, so I've left it out)
 

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