[AccessD] [SPAM SUSPECT] Re: [SPAM SUSPECT] Re: Raisingerrors...

Charlotte Foust cfoust at infostatsystems.com
Tue Aug 8 16:17:47 CDT 2006


Backup.  Is the routine in a class?  Is it being called from a class?

Charlotte Foust

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bobby Heid
Sent: Tuesday, August 08, 2006 1:42 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] [SPAM SUSPECT] Re: [SPAM SUSPECT] Re:
Raisingerrors...

A class object.

Bobby

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Tuesday, August 08, 2006 4:31 PM
To: Access Developers discussion and problem solving
Subject: [SPAM SUSPECT] Re: [AccessD] [SPAM SUSPECT] Re: Raising
errors...
Importance: Low


I'ts what happens in .Net, but I don't remember how it works in Access.
Is the error occurring in a class object or a standard module?  

Charlotte Foust

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bobby Heid
Sent: Tuesday, August 08, 2006 12:59 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] [SPAM SUSPECT] Re: Raising errors...

Hi Charlotte,

No I have not.  Is there not a way to bubble the error up to the calling
routine as if the error happened there?

Thanks,
Bobby

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Tuesday, August 08, 2006 3:52 PM
To: Access Developers discussion and problem solving
Subject: [SPAM SUSPECT] Re: [AccessD] Raising errors...
Importance: Low


Raising errors only bumps them up to the next level.  It's a somewhat
passive action.  You have to check for the raised error in the calling
routine.  Have you done that? 

Charlotte Foust

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bobby Heid
Sent: Tuesday, August 08, 2006 12:15 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Raising errors...

I tried to find information in the archives but could not.

I have a class that I am using to handle the opening of databases and
one of the opens a database and returns a database variable.  This works
well.

In the original code, there was error handling in place to handle
'database is opened exclusively by someone...', and other errors.  So in
replacing the opendatabase call with my class call, I would like the
class to raise any errors so that it propagates back to the calling
function.

There are several older passwords that I have to keep track of.

I tried something like this:

Public Function OpenDB(ByVal strDBName As String, ByVal bOpenExclusive
As Boolean, ByVal bRO As Boolean) As Database
Dim db      As Database
Dim i       As Long

   On Error Resume Next

   Set OpenDB = Nothing				'init the db return
value
   
   For i = 0 To NUMPWS - 1

      Set db = Workspaces(0).OpenDatabase(strDBName, bOpenExclusive,
bRO, ";pwd=" & mstrPW(i))

      If Err.Number = 0 Then        'if =0 then good open
         Set OpenDB = db
         Exit For
         End If
 
     If Err.Number <> 3031 Then    'some error other than invalid pw
         Err.Raise Err.Number, "clsPW.OpenDB", Err.Description
         Else
		'if we're on the last pw, and it is invalid, raise an
error
            If i = NUMPWS - 1 Then    'last one
               Err.Raise 3031, "clsPW.OpenDB", "Invalid password"
               End If
         End If

      Next i
   
   
Proc_Exit:
   Exit Function
   
End Function

It executes the err.raise statement as I expected, but nothing happens.
Am I misunderstanding the raise event?

Thanks,
Bobby

--
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

--
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

--
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