User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 423,872 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,972 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 3361 | Replies: 2
Reply
Join Date: May 2005
Posts: 5
Reputation: pmakanga is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pmakanga pmakanga is offline Offline
Newbie Poster

how do i use selectionformula using 2 fields

  #1  
May 25th, 2005
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 108
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: how do i use selectionformula using 2 fields

  #2  
May 25th, 2005
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:

val(combo2.text)

Hope that helps.
Reply With Quote  
Join Date: May 2005
Posts: 5
Reputation: pmakanga is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pmakanga pmakanga is offline Offline
Newbie Poster

Solution Re: how do i use selectionformula using 2 fields

  #3  
May 25th, 2005
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 4:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC