Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help!!! This is minor but urgent!
Message
From
14/12/1999 00:38:57
 
 
To
All
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Help!!! This is minor but urgent!
Miscellaneous
Thread ID:
00303153
Message ID:
00303153
Views:
45
I am using Crystal Reports in my VB6 app but cannot make it display the Crystal Report when the ORDER BY clause of the sql is attached.
Following is the code, can you give me any suggestions?

Dim qryEPA As String
Dim sDate1, sDate2 As String
Dim sLoc1, sLoc2 As String

sLoc1 = frmEPA.cmbLocFrom.Text
sLoc2 = frmEPA.cmbLocTo.Text


qryEPA = "Select * "
qryEPA = qryEPA + " FROM Epa_rate"
qryEPA = qryEPA + " WHERE (Epa_rate.Location >='" + sLoc1 + "'"
qryEPA = qryEPA + " AND Epa_rate.Location <='" + sLoc2 + "')"

'*******THIS IS WHERE THE PROBLEM OCCURS *********'
'If the select case statements below are commented it works
'properly. But when it is included, why doesn't it work?

Select Case frmEPA.cmbSortKey.Text
Case "NAME"
    qryEPA = qryEPA + " ORDER BY Epa_rate.Name"
Case "DIV_DEPT"
    qryEPA = qryEPA + " ORDER BY Epa_rate.Div, Epa_rate.Dept"
Case "EFFDATE"
    qryEPA = qryEPA + " ORDER BY Epa_rate.EffDate"
Case "ACTION"
    qryEPA = qryEPA + " ORDER BY Epa_rate.Action"
End Select

CrystalReport1.Connect = "DSN=PasDSN"
CrystalReport1.ReportFileName = "c:\pas\epa_rating.rpt"
CrystalReport1.SQLQuery = qryEPA
CrystalReport1.Destination = crptToWindow
CrystalReport1.WindowState = crptMaximized
Next
Reply
Map
View

Click here to load this message in the networking platform