D
DaveE
Using Access 2007 with linked tables to SQL2005 and have code like below.
When no record is returned, I want to display my own message to the user, not
the run-time error. What am I missing?
I also have an error handler that catches the 3021 run-time error but it
still won't display my error message.
Dim dblID as Long
Dim rstClient As ADODB.Recordset
Dim strSQL2 As String
Dim strTemplate As String
Set rstClient = New ADODB.Recordset
strSQL2 = "SELECT ReferringEntity, ReviewReport "
strSQL2 = strSQL2 & "FROM dbo_MasterCaseLog "
strSQL2 = strSQL2 & "WHERE ID = " & dblID
rstClient.Open strSQL2, CurrentProject.Connection
If rstClient.BOF And rstClient.EOF Then
MsgBox "A report template has not been defined for " & rstClient!
ReferringEntity & ".", vbCritical, "Data Error"
Exit Sub
End If
When no record is returned, I want to display my own message to the user, not
the run-time error. What am I missing?
I also have an error handler that catches the 3021 run-time error but it
still won't display my error message.
Dim dblID as Long
Dim rstClient As ADODB.Recordset
Dim strSQL2 As String
Dim strTemplate As String
Set rstClient = New ADODB.Recordset
strSQL2 = "SELECT ReferringEntity, ReviewReport "
strSQL2 = strSQL2 & "FROM dbo_MasterCaseLog "
strSQL2 = strSQL2 & "WHERE ID = " & dblID
rstClient.Open strSQL2, CurrentProject.Connection
If rstClient.BOF And rstClient.EOF Then
MsgBox "A report template has not been defined for " & rstClient!
ReferringEntity & ".", vbCritical, "Data Error"
Exit Sub
End If