Solved

Error detected by database DLL

Posted on 2003-11-12
9
1,358 Views
Last Modified: 2011-10-03
I created a Crystal Reports 8.5 report and linked a text file using ODBC. Initially after I created the report and I previewed the report and it worked fine. Then I have a visual basic 6.0 program that writes to the text file and prints the report. But when I try to print it gives me an error message. Then afterwards if I try to open the report and try to preview it, it gives me the following errors

ODBC error:[Microsoft][ODBC Text Driver]Too few parameters. Expected 1.

and

Error detected by database DLL.

The error I get on the VB side is:

Run-time error ‘20534’:                            Error detected by database DLL
   
Here is my code

Private Sub cmdPrint_Click()
    On Error GoTo print_click_error
   
    Dim reportline(15) As String * 35
    Dim part(15) As String * 8
    Dim I As Integer
    Dim shift_date As String * 40
    Dim total_parts As String * 40
    Dim part_num0 As String
    Dim part_desc0 As String
    Dim clock_number As String * 80
       
    #Const fDebug = True
    Dim logon As Integer
   
   
    reportline(0) = " 875   RH PEARL WHITE        "
    reportline(1) = "1875  RH GALAXY BLACK     "
    reportline(2) = "1875  RH DEEP WATER         "
    reportline(3) = "1875  RH COOLNESS SILVER "
    reportline(4) = "1875  RH SMOKE GREY        "
    reportline(5) = "1875  RH SAGE MET           "
    reportline(6) = "1875  RH BERRY RED         "
    reportline(7) = "1875   RH SILICA GOLD       "
    reportline(8) = "1875   LH PEARL WHITE        "
    reportline(9) = "1875   LH GALAXY BLACK     "
    reportline(10) = "1875   LH DEEP WATER         "
    reportline(11) = "1875   LH COOLNESS SILVER "
    reportline(12) = "1875   LH SMOKE GREY         "
    reportline(13) = "1875   LH SAGE MET          "
    reportline(14) = "1875   LH BERRY RED        "
    reportline(15) = "1875   LH SILICA GOLD       "
       
    RSet part(0) = part0
    RSet part(1) = part1
    RSet part(2) = part2
    RSet part(3) = part3
    RSet part(4) = part4
    RSet part(5) = part5
    RSet part(6) = part6
    RSet part(7) = part7
    RSet part(8) = part8
    RSet part(9) = part9
    RSet part(10) = part10
    RSet part(11) = part11
    RSet part(12) = part12
    RSet part(13) = part13
    RSet part(14) = part14
    RSet part(15) = part15
   
   
   
    'Print to text file
   
    'shift report and clock report use the same file
    Open PATH_CLOCK_REPORT_TEXT For Output As #1
    shift_date = dtShiftDate.Value
    Print #1, "Shift Date   :  " & shift_date
    Print #1, " "
    clock_number = Trim(Me.txtClockNum)
    Print #1, "Clock Number :  " & clock_number & String(30, " ")
    Print #1, " "
    Print #1, " "
    Print #1, "Customer Part Number" & String(30, " ") & "Quantity "
    Print #1, " "
    For I = 0 To 15
        Print #1, reportline(I), part(I)
    Next I
   
    Print #1, " "
    Print #1, " "
   
    RSet total_parts = "Total Parts:  " & Me.txtTotalParts.Text
    Print #1, total_parts
    Close #1
   
    'print to printer
    With cr1
        .ReportFileName = PATH_CLOCK_REPORT_CRYSTAL
        .Destination = crptToPrinter
        .Action = 1
    End With
    Me.cmdPrint.Enabled = False

print_click_error:
    #If fDebug = True Then
    If Err.Number = 20534 Then
        cr1.Action = 1
    End If
    #End If
    Select Case Err.Number
        Case 0
            Resume Next
        Case 5
            Resume Next
        Case 20
            Resume Next
        Case Else
            strErrLocation = "cmdPrintClick"
            ErrorCheck Err.Number, Err.Description, strErrLocation
    End Select
End Sub

0
Comment
Question by:shamif
  • 4
  • 3
9 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 9735031
0
 

Author Comment

by:shamif
ID: 9741826
I have already looked at crystal decisions web site and the above code includes their suggestion.

If I reboot my computer it work the first or second try. But after that it starts giving me the error. It will also work if I delete the old report and recreate it. But I cannot keep on rebotting or recreating.  
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9744260
Where are the values for part1, part2, etc set?

mlmcc
0
 

Author Comment

by:shamif
ID: 9747636
part1, part2... value are set inside a function. They are all global integer variables.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 100

Expert Comment

by:mlmcc
ID: 9752297
Are you sure you are getting an error.  You error handling code gets run regardless of whether there is an error or not.

Add an exit sub

    Me.cmdPrint.Enabled = False
    EXIT SUB        '  ADD this line
print_click_error:

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10612462
Did this get resolved?  If so how?

Unless my final comment solved the problem there is nothing here worthy of a PAQ.
If my comment solved the problem I should be awarded the points.  If i didn't solve it then either post the slution or delete this question.

mlmcc
0
 

Author Comment

by:shamif
ID: 10614859
mlmcc,

I couldn't fix the error thats why I had to rewrite the reports. Seting up ODBC connections on client machines wasn't a smart idea either. I rewrote the reports in less time than I spend to fix this problem.
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 10635685
Closed, 125 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now