PDA

Click to See Complete Forum and Search --> : [RESOLVED] I can't understand recordselectionformula


tommygrayson
Feb 16th, 2006, 01:51 AM
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:


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


Is there something wrong?

ganeshmoorthy
Feb 16th, 2006, 02:01 AM
& "{GL_Table.Date} >= '" & Format(DTPicker1.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
& "{GL_Table.Date} <= '" & Format(DTPicker2.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
& "{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]}

ganeshmoorthy
Feb 16th, 2006, 02:02 AM
is your GL_Table.[Date] is having the same format of "MM/dd/yyyy hh:mm:ss"

tommygrayson
Feb 16th, 2006, 02:03 AM
& "{GL_Table.Date} >= '" & Format(DTPicker1.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
& "{GL_Table.Date} <= '" & Format(DTPicker2.Value, "MM/dd/yyyy hh:mm:ss") & "' and " _
& "{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.

tommygrayson
Feb 16th, 2006, 02:06 AM
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

ganeshmoorthy
Feb 16th, 2006, 02:08 AM
then why are you passing the date with time...
just send MM/dd/yyyy

tommygrayson
Feb 16th, 2006, 02:12 AM
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.

tommygrayson
Feb 16th, 2006, 03:03 AM
Now I know why I haven't managed to move on. I must add a DATETIME function in the recordselectionformula.

Thanks anyway.

Hack
Feb 16th, 2006, 06:22 AM
Moved to reporting section.