Problem with selection formula
Problem with selection formula
(OP)
I'm to trying to filter the report data in VB.
The report itself is getting data from the Access .mdb and without filtering works just fine...
In the selection formula I have to filter dates
I tried - "{ShipByWO.Ship Date} >= #" & ToDate(D1) & "# And {ShipByWO.Ship Date} <= #" & ToDate(D2) & "#"
where ToDate is a formating function I use for string - to - date formating.
I also tried "{ShipByWO.Ship Date} Between #" & ToDate(D1) & "# And #" & ToDate(D2) & "#"
it did not work.
I get error message "Error in selection formula"
Please, help me with this....
The report itself is getting data from the Access .mdb and without filtering works just fine...
In the selection formula I have to filter dates
I tried - "{ShipByWO.Ship Date} >= #" & ToDate(D1) & "# And {ShipByWO.Ship Date} <= #" & ToDate(D2) & "#"
where ToDate is a formating function I use for string - to - date formating.
I also tried "{ShipByWO.Ship Date} Between #" & ToDate(D1) & "# And #" & ToDate(D2) & "#"
it did not work.
I get error message "Error in selection formula"
Please, help me with this....
RE: Problem with selection formula
Unless you are in V8, you have to use date literals in the following format:
Date (2000,3,26)
In v8 you have the option of passing:
#3/26/2000#
Ken Hamady
http://www.kenhamady.com/
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
RE: Problem with selection formula
then I have to format it differently..
something like
Format(D1,"yyyy","mm","dd") right?
RE: Problem with selection formula
Date (yyyy,mm,dd)
it will work. The key is to match the Crystal formula syntax with the resulting string. You can open the report designer and put in the formula to work, and then try to match it with your string in VB.
Ken Hamady
http://www.kenhamady.com/
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
RE: Problem with selection formula
now my dates look like
2001,03,21 when they're passed as an arguments
and it is not working...
do I need brackets?? and a word Date???
RE: Problem with selection formula
{Module.Ship Date} in "2001/01/11 11:20:44.00" to "2001/03/07 13:12:11.00"
this is what I get in my intermidiate window
{ShipByWO.Ship Date} In 2001/03/06 To 2001/03/20
or
{ShipByWO.Ship Date} In (2001/03/06) To (2001/03/20)
or
{ShipByWO.Ship Date} In '2001/03/06' To '2001/03/20'
but how to put them in double quotes?
and how to make this selection work...?
RE: Problem with selection formula
Date (2001,3,25)
Ken Hamady
http://www.kenhamady.com/
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
RE: Problem with selection formula
Thank you very, very much!!!!!:)))))))
It works!:)))))