Odd Behavior With CommitTrans 
Author Message
 Odd Behavior With CommitTrans

Recordsets are used within the scope of a procedure. When the procedure ends
the recordset is dead to.
To use a recordset within another procedure you must pass the recordset
variable to that procedure. For instance when you can change the Initialize
Sub to a function and call the Initialize function with a return argument as
recordset so that when calling this function your procedure will receive the
Private Function Initialize() as Recordset
    On Error GoTo 0
    Set db = CodeDb
    Set rst = db.OpenRecordset("qrySys_JournalPeriods")
End Sub

Function GetPeriodID(PeriodDate As Date) As Long
    Dim SqlWhere As String, rst as recordset
    On Error GoTo 0
    SqlWhere = GetSQLWhere(PeriodDate)
    rst = Initialize()
    With rst
        .FindFirst SqlWhere
I hope this will help you.

Tue, 19 Sep 2000 03:00:00 GMT  
 Odd Behavior With CommitTrans

I guess I should have included my module declares, rst is at the module
level and is in scope in this case. But I do appreciate your response.
Again, the routines all work until I attempt to run them twice in a row. The
problem is that all of the recordsets in the call stack get uninitialized
even though they are still in scope. Note the following post from 3/18/98.

Subject:      Access97 committrans behavior

Date:         1998/03/18

Newsgroups:   borland.public.delphi.database.desktop[More Headers]

I'm working with an Access97 database using DAO3.5 through an OLE automation
connection rather than through the BDE.I'm finding that the statement
invalidates all my dataset objects, which must then be reopened before
proceeding. The objects aren't set to nil--but the next call returns an Ole
'object invalid or no longer set' error. Is this normal? Anyone else
Also, the Microsoft documentation says that the call should be
  CommitTrans (dbFlushOSCacheWrites)
but there's no such constant in the type library,
nly{ CommitTransOptionsEnum }
  dbForceOSFlush = 1;ThanksBobD

This is a real issue, please, more help is needed.

Tue, 19 Sep 2000 03:00:00 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Odd Behavior With CommitTrans

2. Odd behavior with Dates -A2K

3. Access 2.0 odd transaction behavior

4. odd Add Note behavior

5. Externally adding tasks via SQL gives odd behavior

6. Odd recalc behavior with shapeobj.duplicate

7. Odd behavior when inserting TextBox1 into header

8. Odd behavior by socket.select()

9. Very odd behavior with DataTable.Select

10. odd behavior in Qbasic

11. Help, VFP - List boxes on pageframes with odd behavior

12. Odd printing behavior on Win2000


Powered by phpBB® Forum Software