Err Msg: "20534: Error detected by database DLL" with Visual Basic 6 SP3
The information in the article refers to:
Crystal Reports 8.5
Reported version and lower
Crystal ActiveX (OCX) Control
ODBC connection to a text file
Error "20534: Error detected by database DLL"
A Microsoft Visual Basic application uses the Crystal Reports OCX control (crystl32.ocx) as the reporting development tool.
A Crystal Report is created using Microsoft's ODBC driver for text files. When attempting to preview the report in Microsoft Visual Basic, the following error message appears:
Run-time error "20534: Error detected by database DLL"
Using ODBC Trace generates the error:
Run time error '-2147467259 (80004005)': [Microsoft][ODBC Text Driver] Selected collating sequence not supported by the operating system
The report previews successfully in the Crystal Reports designer and when the project is compiled into an executable.
Similar errors occur with other Crystal Reports Development tools:
- The Automation Server (cpeaut32.dll) displays the same error.
- The Print Engine API (crpe32.dll) displays error "534: Error detected by database DLL"
- The Report Designer Component displays the error "Selected collating sequence not supported by the operating system" (see Knowledge Base article c2007927 for further details).
This is a known issue within the Microsoft Visual Basic Service Pack 3 and higher. For more information on this issue refer to Microsoft Knowledge Base article Q246167 at http://support.microsoft.com/
To run the project in the Visual Basic IDE, use the following error trapping code:
#Const fDebug = true
Dim logon as integer
On Error GoTo traperror:
.ReportFileName = <path to report file>
logon = .LogOnServer("pdsodbc.dll","<Your DSN>","","","")
.Action = 1
#If fDebug = true then
If Err.Number = 20534 Then
CrystalReport1.Action = 1
The error trapping code is only run if the fDebug variable is set to True. Before compiling your application to distribute to users, set fDebug to False. Your application will then not run the debugging code in the compiled executable.
Hope this helps.