|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
SQL queries and Crystal reports
Hi
I want to pass a sql query to a crystal report.But I want the sql query to have a vb variable in the 'WHERE' clause. In vb the sql query looks as follows: "SELECT * from surveys WHERE custName = ' " & variable & " ' " Basicly I just want the report to display one record at a time based on the sql query. All I want to know is how do I get that query so that the report can use it. I hope I explained well enough. Please Help!! Thanx Koos. |
|
#2
|
|||
|
|||
|
Use a stored Procedure instread of a view
On Error GoTo error_Handler Dim adoRS As Recordset Dim objCmd As New ADODB.Command Dim rsstring As String Dim oReport As New CR_rptOne Dim i As Integer Dim s As String Dim sInput As String 'Screen.MousePointer = vbHourglass sInput = InputBox("Enter the billing period. (IE 0503 - May 2003)", "Billing Period") Set adoRS = New ADODB.Recordset rsstring = "sp_parmView_Billing_Detail ('" & sInput & "')" adoRS.Open rsstring, adoCN, adOpenStatic, adLockBatchOptimistic, adCmdStoredProc oReport.DiscardSavedData oReport.Database.SetDataSource adoRS, 3, 1 frmCRYSTAL.Show frmCRYSTAL.CRViewer91.ReportSource = oReport frmCRYSTAL.CRViewer91.ViewReport Screen.MousePointer = vbDefault Exit Sub error_Handler: Screen.MousePointer = vbDefault Select Case Err.Number Case Is = 5 MsgBox "Error Occurred Error Number: " & Err.Number & " Error Desc: " & Err.Description Case Else MsgBox "Error Occurred Error Number: " & Err.Number & " Error Desc: " & Err.Description End Select S- |
|
#3
|
|||
|
|||
|
I HAVE THIS WORKING FOR MDB LOOKS GOOD BUT NOW THEY WANT IT FOR SQL SRV:
With CrystalReport1 .ReportFileName = App.Path & "\EmpDetails.rpt" ' .Connect = App.Path & "\EmpData.mdb" ' .DataSource = cndb .DiscardSavedData = True .RetrieveDataFiles .ReportSource = 0 ' .SQLQuery = "Select * from DataBaseProject order by lName" .SQLQuery = "Select * from employee order by lName" .ReportTitle = "Employee Details Report" .Destination = crptToWindow .PrintFileType = crptCrystal .WindowState = crptMaximized .WindowMaxButton = False .WindowMinButton = False If strQryString <> "{DatabaseProject.lName} ='Select All'" Then .SelectionFormula = strQryString End If .Action = 1 End With ANY IDEAS: THX Tom |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > SQL queries and Crystal reports |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|