473,395 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Record Selection in Crystal Reports 9 using VB.net

16
How to use the record selection formula in CR9 programatically using vb.net? I have a combo box that displays the date. If I select date, I can generate a report based on the selected date. Thanks in advance
Nov 23 '07 #1
16 11608
QVeen72
1,445 Expert 1GB
Hi,

Pass this RecordSelectionFormula to the Report:

Expand|Select|Wrap|Line Numbers
  1. m_Report.RecordSelectionFormula ="{MyTable.MyDateField} =Date(" & Format(Combo1.Text,"yyyy,mm,dd") & ")"
  2.  
Regards
Veena
Nov 23 '07 #2
freedom
16
Ah, I see, that's what Im missing, I acutally used that ".recordselectionformula = Date & " combbox.text....and it says a date-time is required here... I guess this is what Im missing. Thanks for your response. I check it out.
Nov 23 '07 #3
freedom
16
Hi Veena,
I tried to used this in my record selection, however, I received an error, "The ) is missing" when I checked it, any part here that I missed? thnks.

VB code:
CrystalReportViewer1.SelectionFormula = "{vTITO_Rpt.WorkDate} In Date (" & Format(cmbxDateFrom.Text, "YYYY,MM,DD") & ") To Date (" & Format(cmbxDateTo.Text, "YYYY,MM,DD") & ")"

Regards
Nov 26 '07 #4
QVeen72
1,445 Expert 1GB
Hi,

For CR9, it .RecordSelectionFormula.
Looks like, you have not declared the Report Object..
What code are you using to display the report...?
Check this :

m_Report.SelectionFormula = "{vTITO_Rpt.WorkDate} In Date (" & Format(cmbxDateFrom.Text, "YYYY,MM,DD") & ") To Date (" & Format(cmbxDateTo.Text, "YYYY,MM,DD") & ")"


Regards
Veena
Nov 26 '07 #5
freedom
16
The "m_report" here you use is the Crystal Report viewer, right? I'm using CR9, tried to use the .RecordSelectionFormula, but it's not working. I tried to use the previous post you have here but still to no avail. What do I miss here? Thanks
Nov 26 '07 #6
QVeen72
1,445 Expert 1GB
Hi,

Post your complete code here..
It will be easy for me to Identify..

Regards
Veena
Nov 26 '07 #7
freedom
16
Hi Veena,

Here is my code I used, I can't find what's seems to the error here, but everytime I used it, I encountered the error "The ) missing" . Thanks in advance

CrystalReportViewer1.ReportSource = New ReportName CrystalReportViewer1.ReportSource = ReportDocument
CrystalReportViewer1.SelectionFormula = "{vTITO_Rpt.WorkDate} In Date (" & Format(cmbxDateFrom.Text, "YYYY,MM,DD") & ") To Date (" & Format(cmbxDateTo.Text, "YYYY,MM,DD") & ")"
CrystalReportViewer1.Show()

Regards
Nov 26 '07 #8
QVeen72
1,445 Expert 1GB
Hi,

Syntax of SelectionFormula seems OK,
Did you check both the combo-boxes, have data..?
You may get error, if either one of them is Blank...

and FromDate < ToDate..?

Regards
Veena
Nov 26 '07 #9
freedom
16
Hi,

Yes, both combo boxes has data, I even tried to change the combo box to text box, inputting the date manuallu, but to no avail. Can we say that the code is ok?

Thanks
Nov 26 '07 #10
QVeen72
1,445 Expert 1GB
Hi,

Selection formula syntax is OK.
But, Without Selection Formula, does your Code Work perfectly...?

Regards
Veena
Nov 26 '07 #11
freedom
16
HI Veena,

I tried to see check it on the crystal report "show formula" then I tried to used this in my code using the below syntax, it worked well. However, as you can see it was not based on the input on the combo box. It was manually inputted on the selection expert. Thanks

mySelectFormula = "{vTITO_Rpt.EmpNo} In Date (2007, 10, 08) to DateTime (2007, 10, 09)"
Nov 26 '07 #12
QVeen72
1,445 Expert 1GB
Hi,

I'am not sure, if this is correct..
In your selection formula you are saying "vTITO_Rpt.EmpNo"
Is EmpNo the Date field in table vTITO...?


Regards
Veena
Nov 26 '07 #13
freedom
16
Hi Veena,

Im sorry I posted a wrong one. Here is the code. Does it has something to do with the setting up of date format?Thanks.

mySelectFormula = "{vTITO_Rpt.WorkDate} In Date (2007, 10, 08) to DateTime (2007, 10, 09)"
Nov 26 '07 #14
QVeen72
1,445 Expert 1GB
Hi,

OK, How are the Values in ComboBox populated.
Post some sample data from Combobox.
also check the regional setting for Dates..


Regards
Veena
Nov 26 '07 #15
freedom
16
Hi Veena,

I forgot to tell you that my source here is a view and not a table. Also here is the sample data of the combo box

10/8/2007 12:00:00 AM
10/9/2007 12:00:00 AM
10/10/2007 12:00:00 AM

and so on.....

Thanks in advance
Nov 26 '07 #16
freedom
16
Hi Veena,

I got it working!! Thanks for your help. I declarde a variable and set it as date then pass the value of the combo box to it. Got it working now. Thanks for your help

Cheers!!
Nov 27 '07 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pierre | last post by:
Hi, Can anyone tell me how I can populate Crystal Reports, using a DataTable in C#? Regards, Pierre
0
by: tomi | last post by:
Hi I'm using RDC for analyzing .rpt files. I need to output all sections, but by using Section.Name i get names like "Section1", "section2" while I'd like to have names like "Group Header a"...
1
by: lmalavika | last post by:
Hi All, I need to display crystal Reports using ASP. The webserver hosting this will not have Crystal Reports installed on it. We had done a similar requirement in ASP.Net by using the crystal...
0
by: srivalli | last post by:
I am Sridhar In vb I use Crystal Reports for reporting but this if i call the crystal report then it displays once and exit but it dont show i call the Crystal report as Crystalreport1.action=1...
1
by: zEE | last post by:
Hi, I'm facing an issue when I use the MicrosoftMail option for emailing the crystal report. My code is as follows - ReportDocument ReportFile = new ReportDocument();...
2
by: chyogesh76 | last post by:
i created a report in crystal report i am using it in vb6.0. while printing through vb it was printing in a4 size but i want make it custom size(small size 5'' X10"). how can i do. any one please...
4
by: Smish | last post by:
please can ne1 guide me how to create a report by passing parameters by using crystal reports using c# thanx
1
by: Roy Brown | last post by:
I am trying to use Crystal Reports X1 with Visual basic 6 and an Access 2003 database, I have downloaded an evaluation copy of Crystal Reports and have tried to run the sample code provided, this...
1
by: meshmeshaa | last post by:
hiii , really need help and quickly please... i have created a database using php and i need to get reports from this database using php code but i don't know how to make crystal reports using...
0
by: ramkumar533 | last post by:
Hi All.. Now i am doing a Project related with students report. There i need to display the each student profile with his image.. The image location is stored in the database...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.