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
"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