944,124 Members | Top Members by Rank

Ad:
May 25th, 2005
0

how do i use selectionformula using 2 fields

Expand Post »
Hi,
Could anyone out there give me some help in using selectionformula or any other method in printing a report. I have designed a program in vb 6 and i want it to select flight No details and Date using crystal report 8. I have used the following code but i get type mismatch error

Dim ATMhist as CrystalReports
Dim ATMDate as Date
Set ATMhist = CrystalReport1

ATMDate = Format(txtHDate.Text, "YYYY,mm,dd")

ATMhist.SelectionFormula = "{TManifestHistory.date} = date ( " & ATMDate & " )" And "{TManifestHistory.FlightNo}='" & Combo2 & "'"
ATMhist.WindowState = crptMaximized
ATMhist.Action = 1

NB: I linked the crystal report control to the report file at design time

rgds,
Patrick
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pmakanga is offline Offline
5 posts
since May 2005
May 25th, 2005
0

Re: how do i use selectionformula using 2 fields

I'm wondering if some of the properties to crystal require a specific data type:
ATMhist.SelectionFormula = "{TManifestHistory.date} = date ( " & ATMDate & " )" And "{TManifestHistory.FlightNo}='" & Combo2 & "'"

TManifestHistory.FlightNo, for example, might be expecting an integer, instead of a string (Returned from combo2), and if it's impartial to the data type, using combo2 without a specific property is a bad idea. Combo2.text would be a better solution to that. You might encase combo2.text with a val:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. val(combo2.text)

Hope that helps.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
May 25th, 2005
0

Re: how do i use selectionformula using 2 fields

True its a bad idea in case the expected field is an integer but combo2 is suppose to accomodate a flight No which is a string e.g "SXY 715". I have tried making it
cstr(combo2.text) but still getting
Run-time error '13': type mismatch

rgds,
Patrick
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pmakanga is offline Offline
5 posts
since May 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: about project
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: VB Newbie Help pls





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC