ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Overcoming an Error Message Q (https://www.excelbanter.com/excel-programming/403325-overcoming-error-message-q.html)

Sean

Overcoming an Error Message Q
 
I have a piece of code that extracts information from an access
database, everthing works well and I use this common file across
various locations. My problem is that a "cannot connect to database"
dialog box appears for a certain location. I know why this is, becase
it doesn't have the relevant access database. Thats okay, I don't need
it, but how could I 'ignore' this error when this error appears and
continue to run the remaining piece of code?

Thanks

The Dude

Overcoming an Error Message Q
 
you could try Application.DisplayAlerts = False at the beginning of your
code, and Application.DisplayAlerts = True at the end.

"Sean" wrote:

I have a piece of code that extracts information from an access
database, everthing works well and I use this common file across
various locations. My problem is that a "cannot connect to database"
dialog box appears for a certain location. I know why this is, becase
it doesn't have the relevant access database. Thats okay, I don't need
it, but how could I 'ignore' this error when this error appears and
continue to run the remaining piece of code?

Thanks


Sean

Overcoming an Error Message Q
 
Nah, doesn't work

The specific message is "ODBC Microsoft Access Driver Login Failed",
it gives an OK/Cancel option and I have to keep clicking Cancel to
move forward

Was hoping that if any error dialog message appeared just ignore and
continue 'actioning' code


SeanC UK[_2_]

Overcoming an Error Message Q
 
Hi,

Can you not add:

On Error Resume Next

on the line before the line where the error appears and then:

On Error Goto 0

(or to wherever your errors were going before) on the line after?

If this works then a better solution would be to test the error value so
that you only ignore the error if it is for this specific reason, then if any
other error occurs an error message will still appear.

Hope this helps,

Sean.
--
(please remember to click yes if replies you receive are helpful to you)


"Sean" wrote:

I have a piece of code that extracts information from an access
database, everthing works well and I use this common file across
various locations. My problem is that a "cannot connect to database"
dialog box appears for a certain location. I know why this is, becase
it doesn't have the relevant access database. Thats okay, I don't need
it, but how could I 'ignore' this error when this error appears and
continue to run the remaining piece of code?

Thanks



All times are GMT +1. The time now is 09:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com