Results 1 to 9 of 9

Thread: [RESOLVED] I can't understand recordselectionformula

  1. #1

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Resolved [RESOLVED] I can't understand recordselectionformula

    Hi guys! This is my first time to use a recordselectionformula on Crystal Reports 10. I get this error that the date-time is required and it points me to this code:

    VB Code:
    1. AnAccountReport.RecordSelectionFormula = "{Account_Code.Account_Code} >= '" & Trim(Text1.Text) & "' and" _
    2.         & "{Account_Code.Account_Code} <= '" & Trim(Text2.Text) & "' and " _
    3.         & "{GL_Table.Date} >= '" & Format(DTPicker1.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
    4.         & "{GL_Table.Date} <= '" & Format(DTPicker2.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
    5.         & "{GL_Table.Date} >= DateTime (2004, 08, 1,00, 00, 00) " _
    6.         & "and " _
    7.         & "if {GL_Table.Date} = '" & Format(DTPicker1.Value, "MM/dd/yyyy hh:mm:ss") & "' then " _
    8.         & "{GL_Table.Entry_Type} <> 'BB' " _
    9.         & "Else " _
    10.         & "{GL_Table.Entry_Type} <> ''"

    Is there something wrong?

  2. #2
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: I can't understand recordselectionformula

    VB Code:
    1. & "{GL_Table.Date} >= '" & Format(DTPicker1.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
    2.         & "{GL_Table.Date} <= '" & Format(DTPicker2.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
    3.         & "{GL_Table.Date} >= DateTime (2004, 08, 1,00, 00, 00) " _

    why are you checking the date for 3 times....

    use Date as [Date]
    {GL_Table.[Date]}
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  3. #3
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: I can't understand recordselectionformula

    is your GL_Table.[Date] is having the same format of "MM/dd/yyyy hh:mm:ss"
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  4. #4

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: I can't understand recordselectionformula

    Quote Originally Posted by ganeshmoorthy
    VB Code:
    1. & "{GL_Table.Date} >= '" & Format(DTPicker1.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
    2.         & "{GL_Table.Date} <= '" & Format(DTPicker2.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
    3.         & "{GL_Table.Date} >= DateTime (2004, 08, 1,00, 00, 00) " _

    why are you checking the date for 3 times....

    use Date as [Date]
    {GL_Table.[Date]}
    The first date is the starting date or from date.
    The second date is the to date.
    The third date is the filtering date.

  5. #5

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: I can't understand recordselectionformula

    Quote Originally Posted by ganeshmoorthy
    is your GL_Table.[Date] is having the same format of "MM/dd/yyyy hh:mm:ss"
    Well its a datetime variable and its format is MM/dd/yyyy

  6. #6
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: I can't understand recordselectionformula

    then why are you passing the date with time...
    just send MM/dd/yyyy
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  7. #7

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: I can't understand recordselectionformula

    Quote Originally Posted by ganeshmoorthy
    then why are you passing the date with time...
    just send MM/dd/yyyy
    Well I also did that but I still have the same error.

  8. #8

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: I can't understand recordselectionformula

    Now I know why I haven't managed to move on. I must add a DATETIME function in the recordselectionformula.

    Thanks anyway.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: I can't understand recordselectionformula

    Moved to reporting section.

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