Solved

Error detected by database DLL

Posted on 2003-11-12
9
1,357 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

11 Experts available now in Live!

Get 1:1 Help Now