Run-Time error 3061

R

redrover

I'm getting a "run-time error 3061. Too few parameters. Expected 2." on
the following code. The error stops on the Set rs= statement. I think I
have a problem with the SQL statement. Can anyone tell me what I need to
change?

Private Sub TQDate_AfterUpdate()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim strSQL As String

Set db = CurrentDb

strSQL = "select qryDisplayTrainingResultsCopyQ.TQDate " _
& "FROM qryDisplayTrainingResultsCopyQ " _
& "WHERE qryDisplayTrainingResultsCopyQ.EvalNbr = " & Me!EvalNbr

Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
Do While Not rs.EOF
If IsNull(rs![TQDate]) Then
With rs
.Edit
rs![TQDate] = Me.TQDate.Value
.Update
End With
End If
rs.MoveNext
Loop
End Sub
 
T

Tom Wickerath

Is "qryDisplayTrainingResultsCopyQ" a parameter query? In other words, when
you run this query in the database window, are you prompted to enter any
parameters at run-time?

You might try adding some code similar to what I show on page 11 of the
current copy of "Access Links.doc", a Word document that I make available to
others. You are welcome to download a zipped copy from here:

http://www.accessmvp.com/TWickerath/

Also, here are two Knowledge Base articles that deal with error 3061:

Using Eval Function with Parameters in Parameter Queries
http://support.microsoft.com/kb/198462

Errors Concatenating Variables or Controls
http://support.microsoft.com/kb/210244


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
D

Douglas J. Steele

It's possible that it can be a parameter query without the user being
prompted: it could be getting values from fields on an open form.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Tom Wickerath said:
Is "qryDisplayTrainingResultsCopyQ" a parameter query? In other words,
when
you run this query in the database window, are you prompted to enter any
parameters at run-time?

You might try adding some code similar to what I show on page 11 of the
current copy of "Access Links.doc", a Word document that I make available
to
others. You are welcome to download a zipped copy from here:

http://www.accessmvp.com/TWickerath/

Also, here are two Knowledge Base articles that deal with error 3061:

Using Eval Function with Parameters in Parameter Queries
http://support.microsoft.com/kb/198462

Errors Concatenating Variables or Controls
http://support.microsoft.com/kb/210244


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

redrover said:
I'm getting a "run-time error 3061. Too few parameters. Expected 2."
on
the following code. The error stops on the Set rs= statement. I think I
have a problem with the SQL statement. Can anyone tell me what I need to
change?

Private Sub TQDate_AfterUpdate()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim strSQL As String

Set db = CurrentDb

strSQL = "select qryDisplayTrainingResultsCopyQ.TQDate " _
& "FROM qryDisplayTrainingResultsCopyQ " _
& "WHERE qryDisplayTrainingResultsCopyQ.EvalNbr = " & Me!EvalNbr

Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
Do While Not rs.EOF
If IsNull(rs![TQDate]) Then
With rs
.Edit
rs![TQDate] = Me.TQDate.Value
.Update
End With
End If
rs.MoveNext
Loop
End Sub
 
R

redrover

THanks! It is a parameter query.

Tom Wickerath said:
Is "qryDisplayTrainingResultsCopyQ" a parameter query? In other words, when
you run this query in the database window, are you prompted to enter any
parameters at run-time?

You might try adding some code similar to what I show on page 11 of the
current copy of "Access Links.doc", a Word document that I make available to
others. You are welcome to download a zipped copy from here:

http://www.accessmvp.com/TWickerath/

Also, here are two Knowledge Base articles that deal with error 3061:

Using Eval Function with Parameters in Parameter Queries
http://support.microsoft.com/kb/198462

Errors Concatenating Variables or Controls
http://support.microsoft.com/kb/210244


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

redrover said:
I'm getting a "run-time error 3061. Too few parameters. Expected 2." on
the following code. The error stops on the Set rs= statement. I think I
have a problem with the SQL statement. Can anyone tell me what I need to
change?

Private Sub TQDate_AfterUpdate()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim strSQL As String

Set db = CurrentDb

strSQL = "select qryDisplayTrainingResultsCopyQ.TQDate " _
& "FROM qryDisplayTrainingResultsCopyQ " _
& "WHERE qryDisplayTrainingResultsCopyQ.EvalNbr = " & Me!EvalNbr

Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
Do While Not rs.EOF
If IsNull(rs![TQDate]) Then
With rs
.Edit
rs![TQDate] = Me.TQDate.Value
.Update
End With
End If
rs.MoveNext
Loop
End Sub
 

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

Similar Threads


Top