Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenRecordset - too few parameters 1

Status
Not open for further replies.

Kiwiman

Technical User
May 6, 2005
88
GB
I am having difficulty in opening a recordset that restricts the data to a particular QID, which is on a form frmQuotes, but I get the follwoing error message.

"Run-time Error '3061'
Too few parameters. Expected 1."


I think it may be falling down when it tries to filter the recordset, based on the form QID, but... I am just getting to grips with the openrecordset, so any help would be appreciated.

Regards

Code:
Private Sub InvoiceCreate()

Dim RS As DAO.Recordset
Dim RS2 As Recordset
Dim strSql As String
Dim intVal As Integer

strSql = "SELECT tblQuotes.QID, tblQuoteLine.Hours, tblQuoteLine.Rate " & _
"FROM tblQuotes INNER JOIN tblQuoteLine ON tblQuotes.QID = tblQuoteLine.QID " & _
"WHERE (((tblQuotes.QID)=[Forms]![frmQuotes]![QID]))"

Set RS = CurrentDb.OpenRecordset(strSql)

RS.MoveLast
RS.MoveFirst

intVal = 0
While Not RS.EOF
intVal = intVal + (RS![Hours] * RS![Rate])
RS.MoveNext
Wend

Me.txtValue = intVal

RS.Close

End Sub
 
[tt]"WHERE tblQuotes.QID='" & [Forms]![frmQuotes]![QID] & "'"[/tt]
If QID is defined as numeric in tblQuotes then get rid of the single quotes.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top