Hi Jason,
A couple of questions before I get into your code. What database are
you using and how are you connecting to it?
What method or property are you using to log the report onto the
database with?
What version of Crystal are you using?
Looking at the code snipets you sent, there is nothing here indicating
anything you are doing with the database so I doubt this is the
problem. I do have a question about Case5 and where you are setting the
SelectionFormula though. I noticed you have a variable called IsSQL and
you are passing that to update the Record Selection Formula. What is in
that String. If you pasted that string into the report in the Report
Designer and ran it, does it work? Sometimes the problem may be in the
formula and running that exact same formula inside the Report Designer
will help with any syntax problems.
If you are logging onto a different database or server than the one you
created the reports with, you will need to use the DataFiles property
for each of the tables in the report to point the report to the new
table locations.
Please reply with the above answers and I'll try to help you more.
--
Sincerely,
Brian Dong
To reply, remove nospam from the address.
Quote:
> I have a problem that is making me pull my hair out!! I have a
>
Crystal Report that I'm passing parameters to via VB. All the other
> reports work fine in my app. The report runs fine when I preview it in
> Crystal and add the value I'm trying to pass from VB.
> The offending section is bolded although I think specifically it's the
> last bolded line. I included CASE 5 because it works. So does the
> elseif in CASE 4. The error is 20599- Can't find SQL server. Any
> ideas?
> Jason
> Case 4 ' reserve table view
> If Len(gsSelectedRegion) > 0 Then
> If mbSelectCheck = True Then 'select all bands from
> selected region
> msReportName = "View_reserveAll.rpt"
> rptViewReport.Formulas(1) = "txtRegionEName=""" &
> msRegionEName & """"
> rptViewReport.Formulas(2) = "txtRegionFName=""" &
> msRegionFName & """"
> rptViewReport.Formulas(3) =
> "txtDistrictName=""N/A"""
> rptViewReport.SelectionFormula =
> "{REGION.REGION_RPN} = " & gsSelectedRegion
> ElseIf Len(gsSelectedBand) > 0 Then
> rptViewReport.Formulas(1) = "txtRegionEName=""" &
> msRegionEName & """"
> rptViewReport.Formulas(2) = "txtRegionFName=""" &
> msRegionFName & """"
> rptViewReport.Formulas(3) = "txtDistrictName=""" &
> msDistrictName & """"
> rptViewReport.Formulas(4) = "txtBandName=""" &
> msBandName & """"
> rptViewReport.SelectionFormula =
> "{COLLECTION_BAND_RESERVE.BAND_RPN} = " & gsSelectedBand
> Else
> MsgBox VBLM_RTString(190), vbOKOnly
> GoTo Exit_cmdPrint_Click
> End If
> Else
> MsgBox VBLM_RTString(188), vbOKOnly
> GoTo Exit_cmdPrint_Click
> End If
> Case 5 ' tribal table view
> If Len(gsSelectedRegion) > 0 Then
> If mbSelectCheck = True Then 'Select all bands from
> selected region
> rptViewReport.Formulas(1) = "txtRegionEName=""" &
> msRegionEName & """"
> rptViewReport.Formulas(2) = "txtRegionFName=""" &
> msRegionFName & """"
> rptViewReport.Formulas(3) =
> "txtDistrictName=""N/A"""
> lsSQL = "{V_RDTCB.REGION_RPN} = " &
> gsSelectedRegion
> ElseIf Len(gsSelectedTribal) > 0 Then
> lsSQL = "{V_RDTCB.REGION_RPN} = " &
> gsSelectedRegion
> 'May or may not have a district associated to a
> band
> If Len(gsSelectedDistrict) > 0 Then
> lsSQL = lsSQL & " AND {V_RDTCB.DISTRICT_RPN} =
> " & gsSelectedDistrict
> End If
> rptViewReport.SelectionFormula = lsSQL
> Else
> MsgBox VBLM_RTString(194), vbOKOnly 'Please select
> a tribal council
> GoTo Exit_cmdPrint_Click
> End If
> Else
> MsgBox VBLM_RTString(188), vbOKOnly
> GoTo Exit_cmdPrint_Click 'Please select a region
> End If