Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Messages - Can I redirect if one appears? 1

Status
Not open for further replies.

rossmcl

Programmer
Apr 18, 2000
128
Is it possible to redirect a user if a error message appears?<br><br>Basically I want to send the user to an 'APOLOGIES' screen if the following error is obtained.<br><br>ie they are trying to connect to an Access database but someone already has one of the tables in the db open.<br><br>Anyone know if this can be done?<br><br>As always, thanks.<br><br>Ross McLanachan<br><br><br>Microsoft OLE DB Provider for ODBC Drivers error '80004005' <br><br>[Microsoft][ODBC Microsoft Access Driver] Could not use '(unknown)'; file already in use. <br><br>/cgi-bin/test/rmclanac/bookings.asp, line 12 <br>
 
Ross,<br>&nbsp;&nbsp;First, put at the top of your page<br><br>On error resume next<br><br>&nbsp;&nbsp;This will suppress error messages from being displayed on the web page. However,&nbsp;&nbsp;you have to be diligent about checking after every major operation to see if an error occurred.&nbsp;&nbsp;Then you can react to the error.&nbsp;&nbsp;Usually you use the error number to determine what happened, but 80004005 is a default value and can be caused by a multitude of different things.&nbsp;&nbsp;In your case,&nbsp;&nbsp;I'd use the error text instead.<br><br>conn.open<br>if err.number &lt;&gt; 0 then<br>&nbsp;&nbsp;&nbsp;&nbsp;if instr(err.description,&quot;file already in use&quot;) then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.redirect &quot;apologies.asp&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.end<br>&nbsp;&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;put code here to react to other errors&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;end if<br>end if<br><br><br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top