help me pls...i want to display the total sales within the date in the two dtpicker and by the category specified...when i run the program using my code an error occurs the no value given for one or more required parameters..which i cannot understand..pls. help me..here is my initial code...
If cbocategory.Text = "All" Then
If rs.State = adStateOpen Then rs.Close
rs.Open "Select * from tblpos where date between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "# ;", cn, adOpenKeyset, adLockOptimistic
While Not rs.EOF
Dim total As Double
With rs
For X = 1 To .RecordCount
total = total + Val(.Fields("amount"))
With ListView1.ListItems.Add(, , rs!nmeitem)
With .ListSubItems
.Add , , rs!qitem
.Add , , rs!rprice
.Add , , rs!amount
End With
End With
.MoveNext
If .EOF Then
With ListView1.ListItems.Add(, , "Total")
With .ListSubItems
.Add = ""
.Add = ""
.Add , , total
End With
End With
End If
Next X
End With
Wend
Else
If rs.State = adStateOpen Then rs.Close
rs.Open "Select * from tblpos where category like '" & cbocategory.Text & "' and date between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "';", cn, adOpenKeyset, adLockOptimistic
While Not rs.EOF
Dim total1 As Double
With rs
For X = 1 To .RecordCount
total1 = total1 + Val(.Fields("amount"))
With ListView1.ListItems.Add(, , rs!nmeitem)
With .ListSubItems
.Add , , rs!qitem
.Add , , rs!rprice
.Add , , rs!amount
End With
End With
.MoveNext
If .EOF Then
With ListView1.ListItems.Add(, , "Total")
With .ListSubItems
.Add = ""
.Add = ""
.Add , , total1
End With
End With
End If
Next X
End With
Wend
End If