[AccessD] Interesting run time error

jwcolby jwcolby at colbyconsulting.com
Fri Mar 14 16:33:50 CDT 2008


Thanks Lambert. 


John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Friday, March 14, 2008 2:54 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Interesting run time error

Just tried this out. With a rowsource of "SELECT foo from bar", where the
table bar does not exist, on first trying to drop-down the combo the error
message displayed is:

"The record source '~sq_cForm1~sq_cCombo0' specified on this from or report
does not exist."  (The form name is "Form1" and the combo name is "Combo0".

However, it is trappable. If you set the form's On Error event handler like
so...


Private Sub Form_Error(DataErr As Integer, Response As Integer)
    MsgBox "Error:" & DataErr & " " & AccessError(DataErr)
    Response = acDataErrContinue
End Sub

You'll see that it's error 2580, and without the msgbox in the handler the
error will just slide by. OF course the user will wonder why there's nothing
in the combo! :-)

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Friday, March 14, 2008 2:14 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Interesting run time error


When a combo is assigned an invalid sql string, perhaps a select from a
non-existent table or a OrderBy clause on a non-existent field, there is not
error until you try to drop down or otherwise use the combo.  The error pops
out of the depths of Access and AFAICT cannot be trapped.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list