Clearing DAO error collection 
Author Message
 Clearing DAO error collection

Is there a way to clear the DAO.EngineDB error collection?  I am
printing a report to Crystal that generates an error in the EngineDB
collection(no current record).  I don't care about this error.  But
later on I try to set the EngineDB.SystemDB path.  The EngineDB does
not accept the new SystemDB path and when I try access one of the
tables, I get an error 3112 because it can't create a lock file on the
.mdw.  Help!!

--
Posted via http://www.*-*-*.com/



Mon, 22 Aug 2005 23:39:22 GMT  
 Clearing DAO error collection
I think you have to close the workspace. (!)
I don't think you have to close the engine.

I think the error objects get detached from the error collection,
but not closed or deleted.  AFAIK, there is nothing you can
do about it other than closing the workspace.

(david)


Quote:

> Is there a way to clear the DAO.EngineDB error collection?  I am
> printing a report to Crystal that generates an error in the EngineDB
> collection(no current record).  I don't care about this error.  But
> later on I try to set the EngineDB.SystemDB path.  The EngineDB does
> not accept the new SystemDB path and when I try access one of the
> tables, I get an error 3112 because it can't create a lock file on the
> mdw.  Help!!

> --
> Posted via http://dbforums.com



Fri, 26 Aug 2005 10:20:30 GMT  
 Clearing DAO error collection
David, have you done this?

I'm interested in any practial experience, as there can be some pretty {*filter*}
side-effects to closing the default workspace, e.g. objects (such as the
RecordsetClone of open forms) go out of scope.

--
Allen Browne - Microsoft MVP (Most Valuable Professional)
Allen Browne's Database And Training - Perth, Western Australia.
Tips for MS Access users - http://www.*-*-*.com/
Reply to the newsgroup. (Email address has spurious "_SpamTrap")



Quote:
> I think you have to close the workspace. (!)
> I don't think you have to close the engine.

> I think the error objects get detached from the error collection,
> but not closed or deleted.  AFAIK, there is nothing you can
> do about it other than closing the workspace.

> (david)



> > Is there a way to clear the DAO.EngineDB error collection?  I am
> > printing a report to Crystal that generates an error in the EngineDB
> > collection(no current record).  I don't care about this error.  But
> > later on I try to set the EngineDB.SystemDB path.  The EngineDB does
> > not accept the new SystemDB path and when I try access one of the
> > tables, I get an error 3112 because it can't create a lock file on the
> > mdw.  Help!!



Fri, 26 Aug 2005 12:00:10 GMT  
 Clearing DAO error collection

Quote:
> side-effects to closing the default workspace, e.g. objects (such

I've not used Crystal Reports for years. The sample code is DAO.
I can't even remember where in this code the lost error objects
are released -- but note that it does not use the default workspace.

--------
The following is very close to code provided by
Marc-Andre Fontaine in Jan 2000.  It was intended
to compare two databases, but you can run it on
just one target database, (one with lots of tables)
comparing to itself.

Matthias Klaey tested it again with A2K2. He found that if
he opened the databases as Exclusive instead of Read-Only,
the memory leak for his test case was only 40Mb instead of
75Mb, and that closing the databases took seconds, rather
than minutes.

--------
Public Function findDiscrepancies(newFileName As String, _
                            FileName As String) As Variant
Dim newField  As DAO.Field
Dim oldField  As DAO.Field
Dim wrkJet    As DAO.Workspace
Dim isField   As Boolean
Dim isProp    As Boolean
Dim myProp    As DAO.Property
Dim newBDD    As DAO.Database
Dim remoteBDD As DAO.Database
Dim lx        As Long
Dim i As Integer, j As Integer

Dim newTabledef As TableDef, oldTabledef As TableDef
Dim newTabledefs As TableDefs, oldTabledefs As TableDefs
Dim aName As String, sSourceTable As String
Dim newTables() As String
Dim fieldDiscrepancies() As String

Set wrkJet = DBEngine.CreateWorkspace("", CurrentUser, "")
Set newBDD = wrkJet.OpenDatabase(newFileName, , True)
Set remoteBDD = wrkJet.OpenDatabase(FileName, , True)
      '1- Find the new tables

On Error GoTo errorHandler
isField = False
Set oldTabledefs = remoteBDD.TableDefs
Call SysCmd(acSysCmdInitMeter, "progress", newBDD.TableDefs.Count)
      'ProgressBar.Min = 0
      'ProgressBar.Max = newBDD.TableDefs.Count
      'ProgressBar.Visible = True
For Each newTabledef In newBDD.TableDefs
          'ProgressBar.Value = ProgressBar.Value + 1
    lx = lx + 1
    Call SysCmd(acSysCmdUpdateMeter, lx)
    If ((newTabledef.Attributes And DB_SYSTEMOBJECT) = 0) Then
        Set oldTabledef = oldTabledefs(newTabledef.name)
        '2- if no error at this point the table exist look for new Fields
        For Each newField In newTabledef.Fields
            isField = True
            Set oldField = oldTabledef(newField.name)
            '3- if no error at this point check for the fields Properties
            For Each myProp In newField.Properties
                isProp = True
                If (oldField.Properties(myProp.name) <> myProp _
                And myProp.name <> "OrdinalPosition" _
                And myProp.name < "ColumnOrder") Then
                       'Msgbox "some bull"
                End If
continue_property:
            Next
            isProp = False
continue_field:
        Next
        isField = False
continue:
    End If
Next
Call SysCmd(acSysCmdSetStatus, "Releasing Memory")
DoEvents

newBDD.Close
Set newBDD = Nothing
remoteBDD.Close
Set remoteBDD = Nothing
wrkJet.Close
Set wrkJet = Nothing

Call SysCmd(acSysCmdClearStatus)
MsgBox "completed"

'findDiscrepancies = newTables
Exit Function
errorHandler:
         If (isProp = True) Then
             Resume continue_property
         End If
      If isField Then
          ReDim Preserve fieldDiscrepancies(j)
          fieldDiscrepancies(i) = newField.name + vbCrLf + newTabledef.name
          j = j + 1
          'MsgBox "New field " + vbCrLf + newField.Name + vbCrLf + "in
Table" + vbCrLf + newTabledef.Name
          Resume continue_field
      Else
          ReDim Preserve newTables(i)
          newTables(i) = newTabledef.name
          i = i + 1
          Resume continue 'No need to go through the fields of the new
table...
      End If
  End Function

--------

Quote:
> David, have you done this?

> I'm interested in any practial experience, as there can be some pretty
{*filter*}
> side-effects to closing the default workspace, e.g. objects (such as the
> RecordsetClone of open forms) go out of scope.

> --
> Allen Browne - Microsoft MVP (Most Valuable Professional)
> Allen Browne's Database And Training - Perth, Western Australia.
> Tips for MS Access users - http://www.*-*-*.com/
> Reply to the newsgroup. (Email address has spurious "_SpamTrap")



> > I think you have to close the workspace. (!)
> > I don't think you have to close the engine.

> > I think the error objects get detached from the error collection,
> > but not closed or deleted.  AFAIK, there is nothing you can
> > do about it other than closing the workspace.

> > (david)



> > > Is there a way to clear the DAO.EngineDB error collection?  I am
> > > printing a report to Crystal that generates an error in the EngineDB
> > > collection(no current record).  I don't care about this error.  But
> > > later on I try to set the EngineDB.SystemDB path.  The EngineDB does
> > > not accept the new SystemDB path and when I try access one of the
> > > tables, I get an error 3112 because it can't create a lock file on the
> > > mdw.  Help!!



Sat, 27 Aug 2005 09:20:34 GMT  
 Clearing DAO error collection

I tried closing the default workspace but this does not appear to clear
the dbengine errors collection.  There also does not appear to be a way
to close the dbengine.  Am I out of luck?

--
Posted via http://dbforums.com



Mon, 29 Aug 2005 03:37:36 GMT  
 Clearing DAO error collection

Originally posted by marklo

Quote:
> I tried closing the default workspace but this does not appear to
> clear the dbengine errors collection.  There also does not appear to
> be a way to close the dbengine.  Am I out of luck?

When running the application thru VB6, the error collection is not
cleared until I stop the application AND unload the code!

--
Posted via http://dbforums.com



Mon, 29 Aug 2005 05:52:57 GMT  
 Clearing DAO error collection
Try looking in help for the DAO Errors collection:

Any operation involving DAO objects can generate one or more errors.
As each error occurs, one or more Error objects are placed in the
Errors collection of the DBEngine object. When another DAO operation
generates an error, the Errors collection is cleared, and the new set
of Error objects is placed in the Errors collection.

--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.


Quote:

> I tried closing the default workspace but this does not appear to
clear
> the dbengine errors collection.  There also does not appear to be a
way
> to close the dbengine.  Am I out of luck?

> --
> Posted via http://dbforums.com



Mon, 29 Aug 2005 14:14:21 GMT  
 Clearing DAO error collection
Did you try running the sample code provided in this thread?
What is your theory?

(david)



Quote:
> Try looking in help for the DAO Errors collection:

> Any operation involving DAO objects can generate one or more errors.
> As each error occurs, one or more Error objects are placed in the
> Errors collection of the DBEngine object. When another DAO operation
> generates an error, the Errors collection is cleared, and the new set
> of Error objects is placed in the Errors collection.

> --
> MichKa [MS]

> This posting is provided "AS IS" with
> no warranties, and confers no rights.



> > I tried closing the default workspace but this does not appear to
> clear
> > the dbengine errors collection.  There also does not appear to be a
> way
> > to close the dbengine.  Am I out of luck?

> > --
> > Posted via http://dbforums.com



Tue, 30 Aug 2005 06:05:19 GMT  
 Clearing DAO error collection
1) don't use the default workspace
2) try switching to a different workgroup
3) are you using a default instance of the dbengine, or an explicit
instance?
4) are you using a workgroup or using an Access/VB Development licence for
Jet (if you rename all workgroup files on your pc, does the application
still run?)

(david)


Quote:

> I tried closing the default workspace but this does not appear to clear
> the dbengine errors collection.  There also does not appear to be a way
> to close the dbengine.  Am I out of luck?

> --
> Posted via http://dbforums.com



Tue, 30 Aug 2005 06:08:47 GMT  
 Clearing DAO error collection
I never saw sample code.

But there is not a way to clear the collection on the default
dbengine.

--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.



Quote:
> Did you try running the sample code provided in this thread?
> What is your theory?

> (david)


in

> > Try looking in help for the DAO Errors collection:

> > Any operation involving DAO objects can generate one or more
errors.
> > As each error occurs, one or more Error objects are placed in the
> > Errors collection of the DBEngine object. When another DAO
operation
> > generates an error, the Errors collection is cleared, and the new
set
> > of Error objects is placed in the Errors collection.

> > --
> > MichKa [MS]

> > This posting is provided "AS IS" with
> > no warranties, and confers no rights.



> > > I tried closing the default workspace but this does not appear
to
> > clear
> > > the dbengine errors collection.  There also does not appear to
be a
> > way
> > > to close the dbengine.  Am I out of luck?

> > > --
> > > Posted via http://dbforums.com



Wed, 31 Aug 2005 22:57:04 GMT  
 Clearing DAO error collection

That's about what I figured.  I have a workaround in place, not the
ideal situation but it will do.  Thanks for everyones help.

--
Posted via http://dbforums.com



Fri, 02 Sep 2005 22:47:06 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Help with understanding Errors collection: DAO/ODBCDirect/Oracle8

2. Help with understanding Errors collection: DAO/ODBCDirect/Oracle8

3. How can i clear the MSHFLEXGRID without CLEAR - Como limpar a GRID sem usar CLEAR

4. Overriding Clear() for a Collection Class

5. Clearing a collection

6. Clearing the Command Objects Parameter Collection for re-use

7. Clear method and collection

8. Clearing the Command Objects Parameter Collection for re-use

9. Bookmark collection with DataGrid control not cleared

10. Clear collection of all members?

11. Clear password in DAO?

12. easiest DAO database clearing method in VB6?

 

 
Powered by phpBB® Forum Software