Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal selection formula- with date field - Pls Help.

Status
Not open for further replies.

fawaz

Programmer
Mar 3, 2001
16
IN
I have a crystal report 4.6 where the selection formula for record read as follows:

{SALES_ORDER_MASTER.CUSTOMER_NO}="AB1" AND
{SALES_ORDER_MASTER.INV_DATE} IN DATE(2001,01,01) TO DATE(2001,03,28) AND
{SALES_ORDER_TRANSACTIONS.TRANS_TYPE}=1

It works fine.

I put this formula in Vb 5.00 with the following modifications:
CRYSTALREPORT1.SELECTIONFORMULA= _
"{SALES_ORDER_MASTER.CUSTOMER_NO}='"& COMBO1.TEXT &"' AND" _
& " {SALES_ORDER_MASTER.INV_DATE} IN "'& text1.text & "'" _ & " TO "'& text1.text & "' AND"_
&" {SALES_ORDER_TRANSACTIONS.TRANS_TYPE}=1"

It gives error in formula

Text1.text and Text2.text are input from calender control.
function- isdate(text1.text) returns True
I tested the statement for customerno and trans_type.
They work fine. Now the problem is date format.

Please correct my code for my mistakes.

 
Dear Friends, It is working with following changes:
fdate = "date(" + Trim(Str(Year(Text1.Text))) + "," + Trim(Str(Month(Text1.Text))) + "," + Trim(Str(Day(Text1.Text))) + ")"

tdate = "date(" + Trim(Str(Year(Text2.Text))) + "," + Trim(Str(Month(Text2.Text))) + "," + Trim(Str(Day(Text2.Text))) + ")"

then I used fdate and todate as strings in the formula.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top