K
Ken
Hi,
First off, I'm using Access 2003 (in 2003 format) and Windows 2000
workstation.
I have a table that I am storing daily counts of different types of
business exceptions. In order to count those exceptions, I use code to
loop through the other tables. Then I create a virtual recordset of
the count table and add the new counts via variables from the VBA code.
Everything works fine (the variables have the right counts, etc.),
EXCEPT... when I go open the count table afterwards, the new record
with the latest daily counts is not there.
Also (recently occuring along with the above problem) I've noticed that
when I go back to code to make changes, I get a message stating that
the database is not opened exclusively and change that I make cannot be
saved. The db is on my desktop and noone else has access to it (since
I'm still developing it).
Any ideas why the record is not writing to the table and why I'm
getting the above message? Also, ideas on how I can do this another
way are definitely welcome. Thanks in advance for any help!
Ken
Here is a snippet of the relevant code...
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set rs = db.OpenRecordset("qryDailyCountofDFRExceptions")
If rs.RecordCount = 0 Then
rs.AddNew
Else
End If
rs.MoveLast
With rs
PreviousDayDFRExceptions = !DFR000 + !DFR001 + !DFR005 +
!DFR010 + !DFR020 _
+ !DFR030 + !DFR040 + !DFR050 + !DFR060 + !DFR070 +
!DFR080 _
+ !DFR090 + !DFR100 + !DFR110 + !DFR900
.AddNew
!Date = Date
!DFR000 = DFR000
!DFR001 = DFR001
!DFR005 = DFR005
!DFR010 = DFR010
... more of the same.....
!ExceptionsAddedFromPreviousDay = NewDFRExceptions
!ExceptionsClosedFromPreviousDay = PreviousDayDFRExceptions +
NewDFRExceptions - DFRExceptions
.Update
End With
Set db = Nothing
Set rs = Nothing
First off, I'm using Access 2003 (in 2003 format) and Windows 2000
workstation.
I have a table that I am storing daily counts of different types of
business exceptions. In order to count those exceptions, I use code to
loop through the other tables. Then I create a virtual recordset of
the count table and add the new counts via variables from the VBA code.
Everything works fine (the variables have the right counts, etc.),
EXCEPT... when I go open the count table afterwards, the new record
with the latest daily counts is not there.
Also (recently occuring along with the above problem) I've noticed that
when I go back to code to make changes, I get a message stating that
the database is not opened exclusively and change that I make cannot be
saved. The db is on my desktop and noone else has access to it (since
I'm still developing it).
Any ideas why the record is not writing to the table and why I'm
getting the above message? Also, ideas on how I can do this another
way are definitely welcome. Thanks in advance for any help!
Ken
Here is a snippet of the relevant code...
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set rs = db.OpenRecordset("qryDailyCountofDFRExceptions")
If rs.RecordCount = 0 Then
rs.AddNew
Else
End If
rs.MoveLast
With rs
PreviousDayDFRExceptions = !DFR000 + !DFR001 + !DFR005 +
!DFR010 + !DFR020 _
+ !DFR030 + !DFR040 + !DFR050 + !DFR060 + !DFR070 +
!DFR080 _
+ !DFR090 + !DFR100 + !DFR110 + !DFR900
.AddNew
!Date = Date
!DFR000 = DFR000
!DFR001 = DFR001
!DFR005 = DFR005
!DFR010 = DFR010
... more of the same.....
!ExceptionsAddedFromPreviousDay = NewDFRExceptions
!ExceptionsClosedFromPreviousDay = PreviousDayDFRExceptions +
NewDFRExceptions - DFRExceptions
.Update
End With
Set db = Nothing
Set rs = Nothing