Results 1 to 2 of 2

Thread: Date Comparison

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2002
    Location
    INDIA
    Posts
    169

    Date Comparison

    I am storing the sales details of a particular client. I am saving client details, the total amount of the bill and the date of the bill.
    I want to generate a report where it will list all the sales which have been made 15 days before the current date.

    CAN ANYBODY HELP PLEASE???

  2. #2
    Lively Member
    Join Date
    Feb 2002
    Location
    India
    Posts
    83

    TRY It

    Try This
    VB Code:
    1. private sub command1_click()
    2.   Dim dat1, dat2 As Date
    3.   dim p               As  String
    4.   dat1 =  CDate(DTP1.Value)
    5.   dat2 = CDate(DTP2.Value)
    6.  
    7. If dat1 > dat2 Then
    8. msg = "Date in first text box should be" & vbCr
    9. msg = msg & "less than second text box"
    10. MsgBox msg, vbInformation
    11. Exit Sub
    12. End If
    13.  
    14. craccreport.ReportFileName = App.Path & "\accountreport.rpt"
    15. yy1 = Year(DTP1.Value)
    16. mm1 = Month(DTP1.Value)
    17. dd1 = Day(DTP1.Value)
    18. yy2 = Year(DTP2.Value)
    19. MM2 = Month(DTP2.Value)
    20. dd2 = Day(DTP2.Value)
    21. p = "{Account.date} >= date(" & yy1 & "," & mm1 & "," & dd1 & ")and {Account.date} <= date(" & yy2 & "," & MM2 & "," & dd2 & ")"
    22. craccreport.SelectionFormula = p
    23. craccreport.Action = 1
    24. end sub

    Don't forget to Include an Instance of Crystal report From Components, and Rename as 'craccreport'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width