cornbread001
Programmer
i keep getting error 3061 to few parameter expected 1. the query that it makes does show up in my queries and it has the correct row count to it but the darn error is consistant i tried everything please help thanks in advanced here is my code.
Private Sub Tax_GotFocus()
Dim intQty As Integer
Dim dblPrice As Double
Dim dblTotal As Double
Dim oldQryRows As String
Dim strRowCntSql As String
Dim dbCnn As DAO.Database
Dim qdfRC As DAO.QueryDef
Dim rcRC As DAO.Recordset
Dim prQdfRC As DAO.Parameter
oldQryRows = "Rows1"
strRowCntSql = "SELECT Count(Sale_Id) " & _
"FROM Part_Sold " & _
"WHERE Part_Sold.[Sale_Id] = [Forms]![Sales]![Part_Sold]![Sale_Id];"
Set dbCnn = CurrentDb
dbCnn.QueryDefs.Delete oldQryRows
Set qdfRC = dbCnn.CreateQueryDef("Rows1", strRowCntSql)
For Each prQdfRC In qdfRC.Parameters
prQdfRC.Value = Eval(prQdfRC.Name)
Next prQdfRC
'qdf![Forms!Sales!Part_Sold!Sale_Id] = Forms![Sales]![Part_Sold]![Sale_Id]
Set qdfRC = dbCnn.OpenRecordset(strRowCntSql)
Debug.Print qdfRC
Debug.Print strRowCntSql
intQty = Me.Part_Sold![Quantity]
Debug.Print intQty
End Sub
Private Sub Tax_GotFocus()
Dim intQty As Integer
Dim dblPrice As Double
Dim dblTotal As Double
Dim oldQryRows As String
Dim strRowCntSql As String
Dim dbCnn As DAO.Database
Dim qdfRC As DAO.QueryDef
Dim rcRC As DAO.Recordset
Dim prQdfRC As DAO.Parameter
oldQryRows = "Rows1"
strRowCntSql = "SELECT Count(Sale_Id) " & _
"FROM Part_Sold " & _
"WHERE Part_Sold.[Sale_Id] = [Forms]![Sales]![Part_Sold]![Sale_Id];"
Set dbCnn = CurrentDb
dbCnn.QueryDefs.Delete oldQryRows
Set qdfRC = dbCnn.CreateQueryDef("Rows1", strRowCntSql)
For Each prQdfRC In qdfRC.Parameters
prQdfRC.Value = Eval(prQdfRC.Name)
Next prQdfRC
'qdf![Forms!Sales!Part_Sold!Sale_Id] = Forms![Sales]![Part_Sold]![Sale_Id]
Set qdfRC = dbCnn.OpenRecordset(strRowCntSql)
Debug.Print qdfRC
Debug.Print strRowCntSql
intQty = Me.Part_Sold![Quantity]
Debug.Print intQty
End Sub