I have two SQL statement that are almost identical, the first one works but the second one blows up. Err Msg: Too few parameters.
I have ck'd the spelling of the fieldnames (they are the same in both) and the spelling of the string value (I even pasted it in. Does anyone have any idea what I could be missing.
strSQL = "SELECT Max(DealDetail_Hdr.COST) AS MaxCards, DealDetail_Hdr.Item " _
& "FROM (Clients " _
& "inner Join Deals on Clients.ID = Deals.ClientId) " _
& "inner Join DealDetail_Hdr " _
& "on Deals.DealID = DealDetail_Hdr.DEALID " _
& "WHERE clientid = " & sID & " And Item = '" & strCards & "'" _
& " GROUP BY DealDetail_Hdr.Item, Clients.ID"
Set rst = db1.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
sItem = rst!MaxCards
GoSub Write_Recs
End If
strSQL = "SELECT Max(DealDetail_Hdr.COST) AS MaxAppear, DealDetail_Hdr.Item " _
& "FROM (Clients " _
& "INNER JOIN Deals on Clients.ID = Deals.ClientId) " _
& "INNER JOIN DealDetail_Hdr " _
& "ON Deals.DealID = DealDetail_Hdr.DEALID " _
& "WHERE clientid = " & sID & " AND Item = " & "Appearance " _
& " GROUP BY DealDetail_Hdr.Item, Clients.ID"
Set rst = db1.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
sItem = rst!MaxAppear
GoSub Write_Recs
End If
Thanks much
Trudye
I have ck'd the spelling of the fieldnames (they are the same in both) and the spelling of the string value (I even pasted it in. Does anyone have any idea what I could be missing.
strSQL = "SELECT Max(DealDetail_Hdr.COST) AS MaxCards, DealDetail_Hdr.Item " _
& "FROM (Clients " _
& "inner Join Deals on Clients.ID = Deals.ClientId) " _
& "inner Join DealDetail_Hdr " _
& "on Deals.DealID = DealDetail_Hdr.DEALID " _
& "WHERE clientid = " & sID & " And Item = '" & strCards & "'" _
& " GROUP BY DealDetail_Hdr.Item, Clients.ID"
Set rst = db1.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
sItem = rst!MaxCards
GoSub Write_Recs
End If
strSQL = "SELECT Max(DealDetail_Hdr.COST) AS MaxAppear, DealDetail_Hdr.Item " _
& "FROM (Clients " _
& "INNER JOIN Deals on Clients.ID = Deals.ClientId) " _
& "INNER JOIN DealDetail_Hdr " _
& "ON Deals.DealID = DealDetail_Hdr.DEALID " _
& "WHERE clientid = " & sID & " AND Item = " & "Appearance " _
& " GROUP BY DealDetail_Hdr.Item, Clients.ID"
Set rst = db1.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
sItem = rst!MaxAppear
GoSub Write_Recs
End If
Thanks much
Trudye