Hello all,
I have a date time picker in vb When the user clicks or changes the
date and time in dtpicker,the value of the dtime picker is passed on
to a text box.Iam converting the text value into date by using cdate
function and on the selection criteria iam using date() function also.
But when i execute my query to get the result in crystal report
iam getting the following error message .

Run time error 20515
not enough arguments have been given to this function.

how do i rectify this error?
my code is as follows.

Thanks
Bye
Faddrick


Dim WithEvents rs1 As Recordset
Dim WithEvents rs2 As Recordset
Dim WithEvents rs3 As Recordset
Dim WithEvents rs4 As Recordset
Dim WithEvents rs5 As Recordset
Dim WithEvents adoprimaryrs2 As Recordset
Dim con As New ADODB.Connection

Private Sub cmdwithoutColl_Click()
If IsDate(Lastpdtxt1.Text) = True Then
asd = " "
asd = CDate(Lastpdtxt1.Text)
asd = Format(asd, "dd/mm/yyyy")

' asd = ""
' asd = CDate(Lastpdtxt1.Text)
' asd = Format(asd, "dd/mm/yyyy")

PartPayEmpLastPdDate.CrystalReport1.DataFiles(0) = App.Path & "\DEBTMASTER.mdb"
PartPayEmpLastPdDate.CrystalReport1.ReplaceSelecti onFormula ("")
'PartPayEmpLastPdDate.CrystalReport1.ReplaceSelect ionFormula ("{PARTPAY.EMPNO} " & conditionCombo11 & " '" & CollCombo1.Text & "' and {PARTPAY.EMPNO} " & conditionCombo22 & " '" & CollCombo2.Text & "' and {PARTPAY.REGION} = '" & RegionCombo.Text & "' and {PARTPAY.REGBATCH} " & conditionCombo1 & " " & BatchCombo1 & " and {PARTPAY.REGBATCH} " & conditionCombo2 & " " & BatchCombo2 & " and {PARTPAY.LAST_PAYDATE} " & conditionCombo111 & " date('" & asd & "') and {PARTPAY.LAST_PAYDATE} " & conditionCombo222 & " date('" & asd1 & "')")
PartPayEmpLastPdDate.CrystalReport1.ReplaceSelecti onFormula (" {PARTPAY.LAST_PAYDATE} " & conditionCombo111 & " date('" & asd & "')")
' PartPayEmpLastPdDate.CrystalReport1.ReplaceSelecti onFormula ("{PARTPAY.EMPNO} " & conditionCombo11 & " '" & CollCombo1.Text & "' and {PARTPAY.EMPNO} " & conditionCombo22 & " '" & CollCombo2.Text & "' and {PARTPAY.REGION} = '" & RegionCombo.Text & "' and {PARTPAY.REGBATCH} " & conditionCombo1 & " " & BatchCombo1 & " and {PARTPAY.REGBATCH} " & conditionCombo2 & " " & BatchCombo2 & " and {PARTPAY.LAST_PAYDATE} " & conditionCombo111 & " #" & CDate(Lastpddp1.Value) & "#) ")


PartPayEmpLastPdDate.CrystalReport1.Destination = crptToWindow
PartPayEmpLastPdDate.CrystalReport1.WindowState = crptMaximized
PartPayEmpLastPdDate.CrystalReport1.Action = 1
End If
End Sub
Private Sub Form_Load()
Set con = New Connection
con.CursorLocation = adUseClient
con.Open "filedsn=C:\WINDOWS\Desktop\SP"

' RegionCombo.SetFocus
Lastpddp1.Refresh

conditionCombo1.AddItem "="
conditionCombo1.AddItem "<="
conditionCombo1.AddItem ">="

conditionCombo2.AddItem "="
conditionCombo2.AddItem "<="
conditionCombo2.AddItem ">="

conditionCombo11.AddItem "="
conditionCombo11.AddItem "<="
conditionCombo11.AddItem ">="

conditionCombo22.AddItem "="
conditionCombo22.AddItem "<="
conditionCombo22.AddItem ">="

conditionCombo111.AddItem "="
conditionCombo111.AddItem "<="
conditionCombo111.AddItem ">="

conditionCombo222.AddItem "="
conditionCombo222.AddItem "<="
conditionCombo222.AddItem ">="

Set rs4 = New Recordset
rs4.Open "select DISTINCT REGION from ACCDBF ORDER BY REGION", con, adOpenStatic, adLockOptimistic
RegionCombo.ListField = "REGION"
Set RegionCombo.RowSource = rs4
End Sub
Private Sub Lastpddp1_Change()
Lastpdtxt1.Text = Lastpddp1
End Sub
Private Sub Lastpddp2_Change()
Lastpddp2.Refresh
Lastpdtxt2.Text = Lastpddp2
End Sub

Private Sub RegionCombo_Click(Area As Integer)
Dim sql, sq As String

sql = "select DISTINCT REGBATCH from ACCDBF where REGION = '" & RegionCombo.Text & "'"
Set rs2 = con.Execute(sql)
BatchCombo1.ListField = "REGBATCH"
Set BatchCombo1.RowSource = rs2

Set rs3 = con.Execute(sql)
BatchCombo2.ListField = "REGBATCH"
Set BatchCombo2.RowSource = rs3


Set rs1 = New Recordset
rs1.Open "select DISTINCT EMPNO from ACCDBF where REGION = '" & RegionCombo.Text & "' ORDER BY EMPNO", con, adOpenStatic, adLockOptimistic
CollCombo1.ListField = "EMPNO"
Set CollCombo1.RowSource = rs1

Set rs5 = New Recordset
rs5.Open "select DISTINCT EMPNO from ACCDBF where REGION = '" & RegionCombo.Text & "' ORDER BY EMPNO", con, adOpenStatic, adLockOptimistic
CollCombo2.ListField = "EMPNO"
Set CollCombo2.RowSource = rs5

End Sub
Private Sub RegionCombo_KeyPress(KeyAscii As Integer)
Dim sql, sq As String

sql = "select DISTINCT REGBATCH from ACCDBF where REGION = '" & RegionCombo.Text & "'"
Set rs2 = con.Execute(sql)
BatchCombo1.ListField = "REGBATCH"
Set BatchCombo1.RowSource = rs2

Set rs3 = con.Execute(sql)
BatchCombo2.ListField = "REGBATCH"
Set BatchCombo2.RowSource = rs3
End Sub