No value given for one or more required parameters

G

Guest

I am getting the error: No value given for one or more required parameters.
The line in my code that is having the problem is:
rs2.Open sSQL, CurrentProject.Connection, adOpenStatic
Does anyone have any ideas?

The code is as follows:
Dim rs As ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim sSQL As String

On Error GoTo Err_Current

Set rs = New ADODB.Recordset
editper = Forms![requests]![Subrequests].Form![StaffID]

'Make the SQL select statment.
sSQL = "SELECT firstname, lastname " & _
"FROM Customers " & _
"WHERE customers.CustID = " & editper

'adOpenStatic makes it readonly. Read up on ADO if you want to edit the data
rs.Open sSQL, CurrentProject.Connection, adOpenStatic

If rs.RecordCount > 0 Then
custname = rs!firstname & "." & rs!Lastname
End If
rs.Close
Set rs = Nothing

editper2 = Forms![requests]![Subrequests].Form![Text56]

'Make the SQL select statment.
sSQL = "SELECT currentuser " & _
"FROM editusers " & _
"WHERE editusers.currentuser = " & editper2

'adOpenStatic makes it readonly. Read up on ADO if you want to edit the data

rs2.Open sSQL, CurrentProject.Connection, adOpenStatic
If rs2.EOF Then
'no records
Else
GoTo Exit_Current:
End If

rs2.Close
Set rs2 = Nothing
 
A

Andreas

Try:
sSQL = "SELECT currentuser " & _
"FROM editusers " & _
"WHERE editusers.currentuser = '" & editper2 & "'"

Regards,
Andreas
 

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