×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problem with selection formula

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....

RE: Problem with selection formula

What version of CR?

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

(OP)
I'm using Crystal Reports for Visual Basic 4.6.10

then I have to format it differently..
something like
Format(D1,"yyyy","mm","dd") right?

RE: Problem with selection formula

No, I think if you pass it in the format I described:

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

(OP)
Sorry, I don't get it...

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

(OP)
this what I get in Formula Editor
{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

The string that you pass has to be a valid formula to Crystal.   That means that the literal has to have the word date and parentheses.  This is an actual literal in a crystal 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

(OP)
AAAAA!!!!!!!!!!!!:)))))))
Thank you very, very much!!!!!:)))))))
It works!:)))))

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close