February 7, 2007 at 1:59 pm
I have a MS Access front end that connects to a SQL Server 2000 table. From this table, access runs a query which works correctly. From this query, Access runs a report. However, when the report tries to run, I get the infamous error "ODBC --call failed". I have another report set up the same way in the same Access database that works perfect. Why would one work and not the other??
Any suggestions???
February 7, 2007 at 4:59 pm
Is the query timing out?
If you can trap the error, sometimes the DBEngine.Errors collection will give you a list of much more intelligent errors. http://www.devx.com/tips/Tip/12413
Russel Loski, MCSE Business Intelligence, Data Platform
February 8, 2007 at 8:41 am
Have you checked to see if every field in the report comes from the query which works ok?
February 8, 2007 at 2:30 pm
Russel-
I tried implementing the following code (as your link indicated):
Private Sub Report_Error(DataErr As Integer, Response As Integer)
Dim sError As String
Dim nI As Integer
Dim sTitle As String
sError = ""
' Determine whether or not this is a
' database error
If DBEngine.Errors.Count > 0 Then
If DBEngine.Errors(DBEngine.Errors.Count - 1).Number = Err.Number Then
sTitle = "Database Error"
For nI = 0 To DBEngine.Errors.Count - 1
sError = sError & DBEngine.Errors(nI) & vbCrLf
Next
sError = sError & vbCrLf
End If
End If
If sError = "" Then
sTitle = "Error"
' add the error string
sError = sError & Err.Description & vbCrLf
End If
' beep and show the error
Beep
MsgBox sError, , sTitle
End Sub
However, the error message was blank implying that this error may not be Database related. The query isn't timing out because the report will not run even after the database is just opened. Perry, I also double checked your hint and that checks out alright. Thanks for the help but so far I'm still stumped...
February 8, 2007 at 2:35 pm
Perry,
upon further review your hint was very helpful. There was a second query in the report I was missing. This was the probem when linking to the SQL server.
Thank you both for the help!!
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply