Jump to content

Crystal Reports formula error

Recommended Posts

EDIT:  Just realized I posted in the wrong section.  Can a moderator move this, please?

Hello.  I've search the forums and internet many times and can't find a solution to my problem.  I started on a UDF to use Crystal Reports and want to be able to export a report multiple times during one run.  The problem lies in the record selection command.  It will work the first time, but randomly fails after that.  The error I get states "Basic syntax is not supported on a record or group selection formula".  The issue is i'm not using basic syntax and my formula doesn't change, just the string within the quotes.  The report will still export, but if the record selection fails then it will use the string saved in the report and not the one I tried to pass.  Below is the main program and I attached two of the include files.  I've considered using a parameter instead, but none of the code I've found online works when I try to pass a parameter.


Global $vSaveFilePath = "C:\Users\public\desktop\test", _
        $vReportFilePath = "C:\Program Files\Chameleon Software\Chameleon\Crystal", _
        $aReportFileName = ["MedHist.rpt","Receipt.rpt","Vacc_Cert.rpt"], _


Func _Run()
    Local $aData = _DataQuery("query string")
    If Not IsArray($aData) Then Exit MsgBox(0,"","Returned no records")

    For $x = 1 To UBound($aData) - 1

        $aSelect[0] = "{KENNEL.IMPOUND_NO} = """ & $aData[$x][4] & """"
        $aSelect[1] = "{RECEIPT.RECEIPT_NO} = """ & $aData[$x][5] & """"
        $aSelect[2] = "{V_Rabies_Vac.tag_no} = """ & $aData[$x][6] & """"

        For $y = 0 To 2
            ConsoleWrite($aSelect[$y] & @CRLF)
            If $aData[$x][$y + 4] <> "" Then _CrystalReportsExport($vReportFilePath & "\" & $aReportFileName[$y],"username","password", $aSelect[$y], $vSaveFilePath & "\" & $aData[$x][3] & "." & StringTrimRight($aReportFileName[$y],4) & "." & $aData[$x][4] & ".pdf")






Edited by JDGenesis

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...