back to top

Problems running Crystal Reports in the Infor CRM (formerly Saleslogix) LAN client

We recently had a client that was using the Crystal RDC object in VBScript within the LAN client to run a Crystal Report.  They were able to run the report once but the second time they tried, the report failed with a “Database Vendor Code 7” error.  Digging in I found the problem.  This was a first for me so I thought I would record it should it ever happen again.

Here is the code I was using:

    filename = Application.BasicFunctions.GetPersonalDataPath & “” & radContractType.Text & ” – ” & frmSchoolContract.CurrentID & “.pdf”
    set rdc = Application.BasicFunctions.GetCrystalReport(family & “:” & report)
    With rdc
         .DiscardSavedData
         For i = 1 To .parameterFields.Count
             .ParameterFields.Item(i).ClearCurrentValueAndRange
         Next

         With .ExportOptions
                 .FormatType = 31 ‘crEFTPortableDocFormat
                 .DestinationType = 1 ‘crEDTDiskFile
                 .DiskFileName = filename
         End With
         .RecordSelectionFormula = “{SCHOOLAGREEMENTS.SCHOOLAGREEMENTSID} = ‘” & frmSchoolContract.CurrentID & “‘”       
    msgbox .SQLQueryString
         .Export false
    End With
    Set rdc = Nothing

I added the msgbox shown in bold to see what the report was using as the SQL result set to run with.  This is what it showed the first time:

 SELECT “ACCOUNT”.”ACCOUNT”, “ADDRESS”.”ADDRESS2″, “ADDRESS”.”CITY”, “ADDRESS”.”STATE”, “ADDRESS”.”POSTALCODE”, “CONTACT”.”FIRSTNAME”, “CONTACT”.”LASTNAME”, “ADDRESS”.”ADDRESS1″, “SCHOOLAGREEMENTS”.”SCHOOLAGREEMENTSID”
 FROM   ((“sysdba”.”SCHOOLAGREEMENTS” “SCHOOLAGREEMENTS” INNER JOIN “sysdba”.”CONTACT” “CONTACT” ON “SCHOOLAGREEMENTS”.”CONTACTID”=”CONTACT”.”CONTACTID”) INNER JOIN “sysdba”.”ACCOUNT” “ACCOUNT” ON “CONTACT”.”ACCOUNTID”=”ACCOUNT”.”ACCOUNTID”) LEFT OUTER JOIN “sysdba”.”ADDRESS” “ADDRESS” ON “ACCOUNT”.”ADDRESSID”=”ADDRESS”.”ADDRESSID”
 WHERE  “SCHOOLAGREEMENTS”.”SCHOOLAGREEMENTSID”=’QV28PB71N7PP’
 ORDER BY “ACCOUNT”.”ACCOUNT”

And this is the SQL that was used when running the second time:

 SELECT “ACCOUNT”.”ACCOUNT”, “ADDRESS”.”ADDRESS2″, “ADDRESS”.”CITY”, “ADDRESS”.”STATE”, “ADDRESS”.”POSTALCODE”, “CONTACT”.”FIRSTNAME”, “CONTACT”.”LASTNAME”, “ADDRESS”.”ADDRESS1″, “SCHOOLAGREEMENTS”.”SCHOOLAGREEMENTSID”
 FROM     (“sysdba”.”CONTACT” “CONTACT” INNER JOIN “sysdba”.”ACCOUNT” “ACCOUNT” ON “CONTACT”.”ACCOUNTID”=”ACCOUNT”.”ACCOUNTID”) LEFT OUTER JOIN “sysdba”.”ADDRESS” “ADDRESS” ON “ACCOUNT”.”ADDRESSID”=”ADDRESS”.”ADDRESSID”

 ORDER BY “ACCOUNT”.”ACCOUNT”

What?  Why did the SQL get all messed up?

I found that pressing Cntlr+F5 allowed me to run the report once more, but failed on the second attempt again.

After lots of digging I found  2 things that had to be changed in order to get the SQL to not get corrupted after running the report.

  1. I had to Add at least one field from the SCHOOLAGREEMENTS table to the report layout.  That fixed the disappearing “FROM” portion of the SQL statement.
  2. After exporting (the .Export false line), I had to set the RecordSelectionFormula = empty.  That fixed the disappearing “WHERE” portion of the SQL statement.

Very strange.  I have never run into this before.  The client was on an older version of SLX so I am not sure if that had something to do with this or not. 

    filename = Application.BasicFunctions.GetPersonalDataPath & “” & radContractType.Text & ” – ” & frmSchoolContract.CurrentID & “.pdf”
    set rdc = Application.BasicFunctions.GetCrystalReport(family & “:” & report)
    With rdc
         .DiscardSavedData
         For i = 1 To .parameterFields.Count
             .ParameterFields.Item(i).ClearCurrentValueAndRange
         Next

         With .ExportOptions
                 .FormatType = 31 ‘crEFTPortableDocFormat
                 .DestinationType = 1 ‘crEDTDiskFile
                 .DiskFileName = filename
         End With
         .RecordSelectionFormula = “{SCHOOLAGREEMENTS.SCHOOLAGREEMENTSID} = ‘” & frmSchoolContract.CurrentID & “‘”
         .Export false
         .RecordSelectionFormula = empty
    End With
    Set rdc = Nothing

 

 

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Kris Halsrud
Kris Halsrud
Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos