SunQuest
 
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old December 30th, 2003, 11:49 AM
Koos Koos is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 10 Koos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old December 30th, 2003, 03:08 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
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-

Reply With Quote
  #3  
Old August 1st, 2004, 10:02 AM
italiantom italiantom is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Palm Springs
Posts: 4 italiantom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Pass Sql String To Sql Srv

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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > SQL queries and Crystal reports


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway