Error: 3601

  • Thread starter Thread starter Stalin
  • Start date Start date
S

Stalin

I have the following code looking up a record count, I am receiving
the 3601 error code on open.
Can anyone see what I might be doing wrong with this? I have enclosed
all parameters in brackets.

Another pair of eyes is requested.

Thanks in advance -
/***********
Private Sub Form_LOAD()
Dim db As Database
Dim rs As Recordset
Dim strSql As String
Dim p1 As String
Dim p2 As String
p1 = [Forms]![tabbed]![EMP2].Form![DEPT_CODE]
p2 = [Forms]![tabbed]![EMP2].Form![EMP_ID]

strSql = "SELECT * FROM SOP WHERE SOP.STATUS = ""ACTIVE"" AND SOP." &
p1 & " = True AND SOP.SOP_ID Not In (SELECT SOP_ID FROM EMP_SOP WHERE
EMP_SOP.EMP_ID = " & p2 & ")"

Set db = CurrentDb()
Set rs = db.OpenRecordset(strSql)

End Sub
***********/
 
In
Stalin said:
I have the following code looking up a record count, I am receiving
the 3601 error code on open.
Can anyone see what I might be doing wrong with this? I have enclosed
all parameters in brackets.

Another pair of eyes is requested.

Thanks in advance -
/***********
Private Sub Form_LOAD()
Dim db As Database
Dim rs As Recordset
Dim strSql As String
Dim p1 As String
Dim p2 As String
p1 = [Forms]![tabbed]![EMP2].Form![DEPT_CODE]
p2 = [Forms]![tabbed]![EMP2].Form![EMP_ID]

strSql = "SELECT * FROM SOP WHERE SOP.STATUS = ""ACTIVE"" AND SOP." &
p1 & " = True AND SOP.SOP_ID Not In (SELECT SOP_ID FROM EMP_SOP WHERE
EMP_SOP.EMP_ID = " & p2 & ")"

Set db = CurrentDb()
Set rs = db.OpenRecordset(strSql)

End Sub
***********/

Do you mean error 3061, by any chance? That's "Too few parameters". I
don't know of any error 3601, so I'm going to guess you mean 3061. If
I'm right, then examine the value of strSql before you open the
recordset. Make sure that all of the field names are correctly spelled
and actually exist in the tables where your SQL thinks they are. Also
make sure that all text literals are enclosed in quotes. For example,
if SOP.EMP_ID is a text value, then you need to surround the embedded
value of p2 with quotes. Otherwise the database engine is going to
think it's a parameter, as it will for any name it doesn't recognize.
 
In


Stalin said:
I have the following code looking up a record count, I am receiving
the 3601 error code on open.
Can anyone see what I might be doing wrong with this? I have enclosed
all parameters in brackets.
Another pair of eyes is requested.
Thanks in advance -
/***********
Private Sub Form_LOAD()
Dim db As Database
Dim rs As Recordset
Dim strSql As String
Dim p1 As String
Dim p2 As String
p1 = [Forms]![tabbed]![EMP2].Form![DEPT_CODE]
p2 = [Forms]![tabbed]![EMP2].Form![EMP_ID]
strSql = "SELECT * FROM SOP WHERE SOP.STATUS = ""ACTIVE"" AND SOP." &
p1 & " = True AND SOP.SOP_ID Not In (SELECT SOP_ID FROM EMP_SOP WHERE
EMP_SOP.EMP_ID = " & p2 & ")"
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSql)
End Sub
***********/

Do you mean error 3061, by any chance? That's "Too few parameters". I
don't know of any error 3601, so I'm going to guess you mean 3061. If
I'm right, then examine the value of strSql before you open the
recordset. Make sure that all of the field names are correctly spelled
and actually exist in the tables where your SQL thinks they are. Also
make sure that all text literals are enclosed in quotes. For example,
if SOP.EMP_ID is a text value, then you need to surround the embedded
value of p2 with quotes. Otherwise the database engine is going to
think it's a parameter, as it will for any name it doesn't recognize.

Little bit of dyslexia there, I did mean error 3061.
Thanks for the second pair of eyes on it, I should have noticed the
quotes missing myself.

Also thanks for the quick response to my post.

Best Regards,

Stalin
 
Stalin said:
I have the following code looking up a record count, I am receiving
the 3601 error code on open.
Can anyone see what I might be doing wrong with this? I have enclosed
all parameters in brackets.
Another pair of eyes is requested.
Thanks in advance -
/***********
Private Sub Form_LOAD()
Dim db As Database
Dim rs As Recordset
Dim strSql As String
Dim p1 As String
Dim p2 As String
p1 = [Forms]![tabbed]![EMP2].Form![DEPT_CODE]
p2 = [Forms]![tabbed]![EMP2].Form![EMP_ID]
strSql = "SELECT * FROM SOP WHERE SOP.STATUS = ""ACTIVE"" AND SOP." &
p1 & " = True AND SOP.SOP_ID Not In (SELECT SOP_ID FROM EMP_SOP WHERE
EMP_SOP.EMP_ID = " & p2 & ")"
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSql)
End Sub
***********/
Do you mean error 3061, by any chance? That's "Too few parameters". I
don't know of any error 3601, so I'm going to guess you mean 3061. If
I'm right, then examine the value of strSql before you open the
recordset. Make sure that all of the field names are correctly spelled
and actually exist in the tables where your SQL thinks they are. Also
make sure that all text literals are enclosed in quotes. For example,
if SOP.EMP_ID is a text value, then you need to surround the embedded
value of p2 with quotes. Otherwise the database engine is going to
think it's a parameter, as it will for any name it doesn't recognize.
(please reply to the newsgroup)

Little bit of dyslexia there, I did mean error 3061.
Thanks for the second pair of eyes on it, I should have noticed the
quotes missing myself.

Also thanks for the quick response to my post.

Best Regards,

Stalin

Sorry bad form, here is the corrected code, thanks again for all you
help.

strSql = "SELECT * FROM SOP WHERE SOP.STATUS = ""ACTIVE"" AND SOP." &
p1 & " = True AND SOP.SOP_ID Not In (SELECT SOP_ID FROM EMP_SOP WHERE
EMP_SOP.EMP_ID = """ & p2 & """)"
 
Back
Top