How To Pass A Parameter In Vb Using Crystal Report 9.0
hi,
i'm using vb 6.0 , access 98 & cr 9.0. plz help me how to pass a parameter using vb 6.0 . in run time.
regards chitkrish
vikramjb : post moved to the reporting section. Please post in the approriate forums.
Edited by - vikramjb on 12/22/2005 2:08:48 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
To Pass Parameter From Vb6 To Crystal Report
Hello Friends,
My problem is I want to accept value from user which I am nt storing in databasse. I am using inputbox to get value from user and then I want to print the same value in the crystal report. I am not using crystal report viewer, but I've used crstyal report's ocx and from there i am opening report by using printreport method of the crystal report's ocx control. plz help me.
below is my code which i m using to print report
VB Code:
With crStudList .Connect = strConn .ReportFileName = App.Path & "
eportsStudentList.rpt" .ReportTitle = "Student List" .WindowTitle = "Student List" '.SelectionFormula = "{tblStudent.RegistrationDate}>= DateValue (" & dtpFrom.Value & ") and {tblStudent.RegistrationDate}<= DateValue(" & dtpTo.Value & ")" .SelectionFormula = "{tblStudent.RegistrationDate}>=#" & Format(dStartDate, "dd/MM/yyyy") & "# and {tblStudent.RegistrationDate}<=#" & dEndDate & "#" .Destination = crptToPrinter .PrintReport End With
where crStudList the name of ocx control of crystal report
thanks
How VB Pass Parameter To Crystal Report
how to pass Parameter to Seagate Crystal report by VB?
I want to pass One or More parameter to Crystal report to meet a certain critera
like i want to select some record by my application given date so report should be contains only those record sort by given date.
How Do I Pass A Parameter Range To A Crystal Report (v8.5)?
Hi
I am using VB6 and Crystal 8.5 (the database is only compatible with this version of Crystal.
I need to pass a parameter range to my VB code, the parameter works fine in Crystal, but I cannot work out how to pass the parameter range in code.
All help very welcome!
Thanks
Blinking Nora
How To Pass Parameter Using Crystal Report Viewer
hi!
I have a report to which i am passing a parameter value custid
i was earlier using just the rdc control and showing the report and passing the parameter by
CrystalReport1.ParameterFields(0) = "custid;" & Combo2.Text & ";true"
now when i use crystal viewer using the foll. code
Dim app1 As CRAXDRT.Application
Dim rep As CRAXDRT.Report
Private Sub Form_Load()
Set app1 = New CRAXDRT.Application
Set rep = app1.OpenReport("c:sales1.rpt", 1)
With Form1
.Show
.CRViewer1.ReportSource = rep
.CRViewer1.ViewReport
End With
End Sub
the report prompts for a parameter
How can i pass the parameter to the report within this code so that the viewer does not prompt for any input
thanks in advance
Mukul
Pass BLOB Parameter To Crystal Report
I would like to display the image from the local file system where I can pass the path or the whole image (in BLOB fieldType). But I found that I cannot set the parameter field type into BLOB (only can set String, Date, Time, etc). What can I do? I found that it works when the photo is stored in database only. Is there anybody can solve this problem?
How Can I Pass Parameter From VB6 To Crystal Report7
I am new In VB & Crystal ,How Can I Pass Parameter from VB6 to Crystal Report7
I was try to pass parameter use Crystal Reports ActiveX Designer Run Time Library but i can not pass it please provide code for passing parameter
To Pass Parameter To Crystal Reports From Vb
hi
i had to pass a parameter for report generation. the parameter has to be passed from a vb -form. i have to do it without reentering(ie directly pass the parameter)
plz help
thanx in advance
Pass A Parameter Value To Crystal Reports Viewer
Hello All,
I’m having difficulty trying to pass a parameter from a text field on a form in my Access application to a Crystal report - which will be displayed in the Crystal Viewer.
CODE
Dim CrxApplication As CRAXDRT.Application
Dim CrxReport As CRAXDRT.Report
Dim strOutputPath As String
strOutputPath = CurrentProject.Path & "CR_Reports"
' Open the Report specified in the Open Common dialog control
Set CrxApplication = New CRAXDRT.Application
Set CrxReport = CrxApplication.OpenReport(strOutputPath & "CRpt", 0)
Pass Parameter To Date Report
I have one more question to ask,
I want to pass some parameter from a form to a data report so that what the user entered in the form can be display on the data report, how can I do it.
I can't find any way to do so.
Thanks....
Pass A Date Parameter For A Report
I have a timesheet management programme which I have written in VB6 which uses an Access97 database. I have several tables, one of which has project details (Projects) and one all the pay and expenses (Timesheets). The ProjectID links both tables.
I have a DataEnvironment ( deProject), a DEConnection (Timesheet222), a DECommand (cmdProject) and a child DECommand (cmdTimesheet).
cmdTimesheet has an SQL statement in the property CommandText
SELECT* FROM Timesheets WHERE Timesheets.dateofwork BETWEEN #31-Mar-07#
AND #05-Apr-07#
ORDER BY Clientname,EmployeeID,DateOfWork DESC
This works fine but I cannot change the dates at run time. I need to be able to pass the date parameters to a statement like this.
I can do this if I only use cmdTimesheet but I want to structure my reports to have the ProjectID and Project Name in a main heading.
Any suggestions would be welcome.
Pass Parameter To Crsytal Report
I have an app that opens a crystal report, sets the login info, passes the parameter, then exports the report. Below is part of the code I am using. I need to run this report multiple times with new parameter values. How can this be accomplished without doing OpenReport everytime?
Dim Report As New CRAXDRT.Report
Dim crxApp As New CRAXDRT.Application
Sub RunReport()
Set Report = crxApp.OpenReport("test.rpt",1)
'''Here I set the login
Report.ParameterFields(1).AddCurrentValue (ldr_id)
With Report.ExportOptions
.DiskFileName = slocation
.FormatType = crEFTPortableDocFormat
.PDFExportAllPages = True
.DestinationType = crEDTDiskFile
End With
Report.Export (False)
Set Report = Nothing
Set crxApplication = Nothing
End sub
Pass Parameter To Child Command In Data Report
hi, ....
i'm using DE connected to Access, and my DE is like this...
Company (Parent Command)
a
b
c
SQL(child command) <<== Problem ***
k
l
m
acccoutingng (child command)
x
y....
i used the SQL builder to setup the sql statement like this ...
"SELECT Brno, City, CNno, Tseqno, TDate, Payment, DOno FROM FECMS_Transaction WHERE (TDate = ?)"
, and went to setup parameter. Everything seems fine except the relation part. I need it to have a relation with the previous level (Company). when i assign the relation, an error message comes out said
"All required parameters must be linked with a parent field." I'm pretty sure linking the right fields between these 2 tables. If i didn't do this part, this level will becomes the same level like "Company".
can someone help me, million million thanks.....
How To Pass Format String To Crystal Report From VB And How To Use It In Crystal Report?
Hi,
I am working on VB 6.0 and using crystal report 7 as reporting tool.
In report, some clients are asking 3 decimal places(Eg. 2000.500) while other clients are asking 2 decimal places(Eg. 2000.50) for numeric fields.
I want to pass the amount of decimal places for numeric fields to crystal report from VB.
How should I implement this using VB.
Pls any one can help me?
Thanks in vance,
Soundar
Pass Input Parameter From Query To Report In Access 2000
I am using a parameter query to sum information from a table. Part of the parameters is to specify the date range to be summed as shown below:
SELECT TOP 10 [Lost Time Codes].Reason, Sum([Master Lost Time Entries].Minutes) AS SumOfMinutes
FROM [Lost Time Codes] RIGHT JOIN [Master Lost Time Entries] ON [Lost Time Codes].code = [Master Lost Time Entries].[Downtime Code]
WHERE ((([Master Lost Time Entries].Shift)="1st") AND (([Master Lost Time Entries].Date) Between [Enter Start Date] And [Enter End Date]) AND (([Lost Time Codes].Area)="THT"))
GROUP BY [Lost Time Codes].Reason
ORDER BY Sum([Master Lost Time Entries].Minutes) DESC;
I want to pass the the [Enter Start Date] and [Enter End Date] inputs to the report containing a chart. Anyone know how to do this, or of a completely different way to accomplish the same task without using the above query?
Edit by Moderator:
Please post SQL questions, in the Database forum.
Thank you.
Sometimes Repeating Previous Dates Data In Report When I Pass Parameter From Vb !
Hai the below is my code,
I am using more than 10 option button in my form. when the form load the textbox will automatically show the date by the code below, when the user check 4 or five reports using different option buttons and while changing the date in the text box, the report is showing for previous date, i also remove the check box for the [Save Data with Report] in the File Menu, when the user changes the date for the first time, it shows the report correctly, kinly see the code below and reply me. I don't know where's the mistake from.
when i exit the application and give for a new date it works, where as repeatedly when i do the same for 6 or some times and change the date, the report for the previous date is shown. I also use break point and checked, it passing the date correctly.
the below are the codes which i am using to display the report.
I also attached the front view of the form, by seeing that u can be clear what's happening.
Private Sub Form_Load()
txtFrom.Text = Format(Date - Day(Date) + 1, "YYYY/MM/DD")
txtTto.Text = Format(Date, "YYYY/MM/DD")
End Sub
Private Sub cmdPreview_Click()
fdt = txtFrom
tdt = txtTo
If Option1.Value = True Then
Call Productwisereport
ElseIf optItem.Value = True Then
Call Itemwisereport
Else
MsgBox "Choose Option !", vbExclamation, "Option - Missing"
End If
End Sub
Private Sub Prodcutwisereport ( )
fdt = txtFrom
tdt = txtTo
If Len(cmbProduct.Text) <= 0 Or cmbProduct.Text = "All" Then
CrystalReport1.ReportFileName = App.Path & "sumcstwisewgt.rpt"
CrystalReport1.Formulas(0) = "fdt='" & fdt & "'"
CrystalReport1.Formulas(3) = "tdt='" & tdt & "'"
strsf = "{Sales.SoldDate} in Date(" & _
Format(fdt, "YYYY,M,D") & ") to Date(" & _
Format(tdt, "YYYY,M,D") & ")"
CrystalReport1.ReplaceSelectionFormula (strsf)
CrystalReport1.Action = 1
Else
CrystalReport1.ReportFileName = App.Path & "sumcstwise.rpt"
CrystalReport1.Formulas(0) = "fdt='" & fdt & "'"
CrystalReport1.Formulas(3) = "tdt='" & tdt & "'"
strsf = "{ Sales.SoldDate } in Date(" & _
Format(fdt, "YYYY,M,D") & ") to Date(" & _
Format(tdt, "YYYY,M,D") & ")"
CrystalReport1.ReplaceSelectionFormula (strsf)
CrystalReport1.GroupSelectionFormula = "{ Sales.Product}='" & cmbProduct.Text & "'"
CrystalReport1.Action = 1
End If
CrystalReport1.GroupSelectionFormula = " "
End Sub
thank you very much,
Chock.
itchocks@rediffmail.com
<HTML>
<B><font color="#008000">HAVE A NICE DAY !</font></B>
<HTML>
Parameter In Crystal Report
Hi,
I am a newcomer in Crystal report. I want to create a report which take a parameter of type date. And all the records of that date should be displayed. The date should be pass from VB6. I dont have any idea of how to do it?
Any help will be appreciated.
Thanx
Parameter In Crystal Report 9
Does anybody have idea how I can get parameter in Crystal report (in Visual Basic 6 application ) from signed variable from module in application.
I want to have one text field on the top of report where will be date which is equel the date from variable in module.
This is my variable in module:
Public myDate As Date
I have error if I sign this under Report_Initialize ...
Text15.Text = myDate
Crystal Report Parameter
Hi!
How can I make sure that my Command SQL inside the Crystal Report can read parameter values.
This is how I've got it:
SELECT * FROM Students WHERE stu_num = '{?stu_num}'
I get a blank report though I'm sending parameters correctly.
Parameter Value To Crystal Report
Hello,
I am calling crystal report from vb6.0, I accept some fields on screen who can i pass these field crystal report for check.
who it will be define in crystal report.
Thanks in advance
Pankaj
Pass A Value To Crystal Report 8
Hi,
This is a question regarding Crystal Report 8
i) There's a vb form with a textbox. User would input, say "ABC" in the textbox. Then, I want to pass the "ABC" into my Crystal Report details field.
Eg:
User only have to input the "ABC" once while the name would be retrieve from the database.
Report generated:
Name Class
Alex ABC
James ABC
Sandy ABC
Can somebody help ?
Pls advice and thanks in advance
pcPirate
Pass Value To Crystal Report
hi,
i've have a table (Access 97) that contain customer information and i need to display certain customer details.
in VB 6.0 form, a text box that allow me to type a customer code and a command button that use to show the report(crystal report 9)
how i pass the text box value to the report when i click the command button ?????? plz help................
thanks
Passing Parameter To Crystal Report
Hello
I want to ask you How can I pass a parameter field to crystal report from Visual Basic 6 ????
I am using the Crystal Report Viewer .
Thank you very much!!!!
Passing A Parameter To Crystal Report
Hello Everyone! I'm new to crystal reports and I want to make an inventory that could pass a parameter to a crystal report. Could you guys help me how to do it? I just need a few simple examples on how to start. Any help will be greatly appreciated. Thanks and god bless!
Crystal Report Parameter Field
Now I've been searching to this forum and Google and found no luck....
I have this crystal report , just named it : report.rpt
and this report got three parameters field that needed to select the record to access the database , namely : prompt0,prompt1,prompt2.
How do I pass the value from the textbox to this parameter field in the report?
I use vb6 and cr 8.5
And I use the activeX Crystal Report in the VB application.
Here is my code :
CrystalReport1.ParameterFields(0) = "prompt0;" + "01" + ";true"
CrystalReport1.ParameterFields(1) = "prompt1;" + " & txtNumber & " + ";true"
CrystalReport1.ParameterFields(2) = "prompt2;" + " & txtNumber & " + ";true"
CrystalReport1.Connect = "DSN=AURORA;UID=UID;PWD=PWD"
CrystalReport1.Action = 1
Everytime I run the code , it gives me the same error code :
"Invalid parameter field value"
When I use the "Val(txtNumber)" , it didn't help.
Please help me.
Thx in advance....
Crystal Report Parameter Problem
Hello everyone. I have this problem in Crystal Report specifically in parameter passing. The report is a Collection Report. Once i chose a month and year, it automatically sets the dateto value four months ahead of the chosen date. So assuming i chose jan and 2004, the range will be jan 1, 2004 to may 31, 2004. But once i use dec for example the range exceeds 1 month as intended. So what appears is dec 1 2004 to may 31, 2004, i cant trace the problem becuase i checked the parameter that i pass and its april 2004 not may 2004.
Here is a segment of my code.
DateFrom = Year(dtYear) & "-" & Month(dtMonth.Value) & "-" & 1
Select Case (Month(dtMonth) + 4)
Case 13
preMonth = 1
preYear = Year(dtYear) + 1
Case 14
preMonth = 2
preYear = Year(dtYear) + 1
Case 15
preMonth = 3
preYear = Year(dtYear) + 1
Case 16
preMonth = 4
preYear = Year(dtYear) + 1
Case Else
preMonth = Month(dtMonth) + 4
MsgBox preMonth
preYear = Year(dtYear.Value)
End Select
MnthEnd2 = Day(EndOfMonth(CDate(preMonth & "/" & 1 & "/" & preYear)))
DateTo = CDate(preYear & "-" & preMonth & "-" & MnthEnd2)
Set crpParamDefs = Rpt.ParameterFields
For Each crpParamDef In crpParamDefs
With crpParamDef
Select Case .ParameterFieldName
Case "@dtFrom"
.ClearCurrentValueAndRange
.SetCurrentValue CDate(DateFrom)
Case "@dtTo"
.ClearCurrentValueAndRange
.SetCurrentValue CDate(DateTo)
End Select
End With
Next
' i used this function to be able to get the last day of the month
Function EndOfMonth(ByVal D As Date)
EndOfMonth = DateSerial(Year(D), Month(D) + 1, 0)
End Function
Help Please.....Thanks
Crystal Report - Passing Parameter
Hi,
please tell me the syntax of SetReportVariableValue in crystal report. I am getting Run-time error '70' permission denied when I try this. any other way to pass parameter to the report? (I'm using CR 9 with VB 6)
Thanks in advance!
Binish
Passing Parameter To A Crystal Report
i'm using vb6 and crystal reports 8.5. i have a string value that i need to pass to my rpt. here is the sample of my code:
Set CRReport = New CRAXDRT.Report
Set CrxApp = CreateObject("CrystalRunTime.Application")
Set CRReport = CrxApp.OpenReport(vstrReportFile)
CRReport.Database.SetDataSource vPassedADORS, 3, 1
CRViewer1.ReportSource = CRReport
CRReport.ParameterFields(0) = " Par1;" + vstrParameters + " ;true"
CRReport.PrintOut False, 1, True
when i run this code i get the error subscript out of range.
when i create another project that uses the crystal report component i use the following code:
cry1.ParameterFields(0) = " Par1;" + vstrParameters + " ;true"
cry1.printreport
it works fine.
can any one help?
Thank You,
Thomas
Discrete Value In Parameter (crystal Report)
hi,
I am using VB6.0 & access as backend.
I am making one report which will print salesmanwise sales. I want to give option to the user to select the salesman & accordingly the sales will get generated. For that I have used parameter option, in that I have selected the table & in field I have selected salesman.
So far so good, The report is giving what I want, but when I add new Salesman to the table and I generate the report again, It is not showing the newly created salesman in the discrete value, any idea.
Is there any refresh Or like that ?
Thanks
ME
Parameter Passing In Crystal Report
I have designed a report in Crystal report 7.0 and wanted to view it thru VB6.0 application. I am using crystal report control. When I refresh my report from crystal report and enter a specific date the report generates for that date but when I refresh it from my VB application and enter any date its not giving anything. Do I need to set some property or something else. please help me. its very urgent.
Kirti
Passing Parameter To Crystal Report
i'm using the CRViewer to view my report. i found out i cannot pass in Date into crystal report from VB. any one can give me help?
sample code:
CrxReport.ParameterFields(1).AddCurrentValue (format(now,"dd/mm/yyyy"))
the parameter in crystal report defined as Date.
thanks.
Parameter Problem In Crystal Report 8.5?
i have problem in parameter using CR 8.5, when i input the name in preparedby text box i want the parameter to directly out put in crystal report. how can i do that?
pls see attached pictures.
Private Sub cmdPrint_Click()
'on error goto err_handler
Dim strsqlstring As String
Dim strparam1 As String
Dim strparam2 As String
If Opt1.Value = True Then
If DTPicker1.Value <> "" And DTPicker2.Value <> "" Then
strsqlstring = "{tbltallyreceipts.dtdate} >= #" & Format(DTPicker1.Value, "mm/dd/yyyy") & "# and {tbltallyreceipts.dtdate} <= #" & Format(DTPicker2.Value, "mm/dd/yyyy") & "# And {tbltallyreceipts.st_services} = '" & cboPrintServices & "'"
strparam1 = frmPrint.txtpreparedby
strparam2 = frmPrint.txtnotedby
End If
With CrystalReport1
.ReportFileName = App.Path & "fdata.rpt"
.Connect = App.Path & "financialdata.mdb"
.DiscardSavedData = True
.RetrieveDataFiles
.ReportSource = 0
.SQLQuery = "Select *from tbltallyreceipts "
.WindowTitle = "Financial Data"
.ReportTitle = "Total Receipts"
.Destination = crptToWindow
.PrintFileType = crptCrystal
.WindowState = crptMaximized
.WindowMaxButton = False
.WindowMinButton = False
.SelectionFormula = strsqlstring
.ParameterFields(0) = "prpreparedby;" & strparam1 & ";false"
.ParameterFields(1) = "prnotedby;" & strparam2 & ";false"
.Action = 1
End With
frmPrint.txtnotedby = ""
frmPrint.txtpreparedby = ""
End If
End Sub
Textbox Parameter In Crystal Report
Can someone show me how to pass a textbox value from vb .net to crystal report?
How can i refresh the report if i change the value in the textbox?
Thanks!!!
Parameter Passing In Crystal Report
I am passing parameters to report ,but it is giveing me error "invalid Field ".
do each field have any specific index,or number in the report .I have designed the report already.
Discrete Value In Parameter (crystal Report)
hi,
I am using VB6.0 & access as backend.
I am making one report which will print salesmanwise sales. I want to give option to the user to select the salesman & accordingly the sales will get generated. For that I have used parameter option, in that I have selected the table & in field I have selected salesman.
So far so good, The report is giving what I want, but when I add new Salesman to the table and I generate the report again, It is not showing the newly created salesman in the discrete value, any idea.
Is there any refresh Or like that ?
Thanks
ME
Null Parameter In Crystal Report Help?
Hay i want explain the report first
i have report get data from table ad also i have 5 parameters .
my question is:
How i can make the report when the parameters enter he get only record how meet these conditions and if the paramters null he get all data also if i enter two or three parameters he get the data whos meet these values
is there any way?
Passing Parameter To Crystal Report
i am passing a string value from vb code to crystal report. in crystal report i have created this parameter as "Pyyyymm" receiving string value.
the vb code goes like this
report1.parameterfields(0) = "Pyyyymm;" & m_SelSalMnth & ";true"
where m_SelSalMnth contains '2002/10' or like value but it gives me error "can't find SQL Server" and error no. 20599.
i don't know where i am going wrong.
i am adding crystal report thru component and not thru reference i.e. i am using a crystal report control.
Waiting for a quick reply.
diamond
Crystal Report Parameter Field
SurrenderMonkey (thanks a lot, man!) find it out how to make those parameter fileds work in VB code:
'A simply report with one parameter field
'Matter is to pass a parameter value to a rpt file
'through Ocx - or: to make parameter fields to be filled
'via code form VB.
Cr1.Reset
Cr1.ReportFileName = "D:CondivisaCesarevbCrystolcrywebReport1.rpt"
Cr1.ReportSource = 0
Cr1.DiscardSavedData = True
Cr1.ParameterFields(0) = "SelectMe;1;false" 'parameter field name={?SelectMe}
'second value is value you want the parameterto gain by default, third
'should 'make it work silently, but it does not work properly: a window appear,
'asking for value. Only if you click on OK button ypu will see your report
Cr1.Action = 1 'make it print
'I posted it here as I think it should be of interest. And if anybody finds out
'how to make this really silent, please tell!
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
|