abu taher 34 Practically a Posting Shark

in data environment I write code

SELECT AccountInfo.incategory, Sum(AccountInfo.InAmount) AS SumOfInAmount
FROM AccountInfo
where Date and Date between DTFr.value and DTTo.vlaue
GROUP BY AccountInfo.incategory;

in form I write code in a command button like:

Private Sub Command2_Click()
     Load DataEnvironment1
    With DataEnvironment1
   If .Command3.State <> 0 Then .Command3.Clos
     .Command3 Format(DTFr.Value, "dd/mm/yyyy"), Format(DTTo.Value, "dd/mm/yyyy")
     End With
datareport1.Show
End Sub

in this form I have two dtpicker. when I run the project , I select two date from this two dtpicker and press the button then a msg show:

compile error:
argument not optional

then highlight this

If .Command3.State <> 0 Then .Command3.Close

please help me anybody

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.