jwcolby
jwcolby at colbyconsulting.com
Wed Dec 22 17:03:30 CST 2010
Place the following in a module
Option Compare Database
Option Explicit
Private cCacheState As clsCacheState
Public Function cCState() As clsCacheState
If cCacheState Is Nothing Then
Dim db As DAO.Database
Set db = CurrentDb
Set cCacheState = New clsCacheState
'The table and field names below must be changed to match your table names
cCacheState.mInit db, "usystblPLSSysVars", "PLSSV_Name", "PLSSV_Val", "PLSDataUpdate"
End If
Set cCState = cCacheState
End Function
Create a table named usystblPLSSysVars with field names PLSSV_Name and PLSSV_Val. Create a record
with the values PLSDataUpdate in the PLSSV_Name and anything at all in PLSSV_Val.
You can actually create a table of any name with fields named whatever you want, but the above works
with the module above so if you create your own table you will need to modify the test code above.
Now in the debug window do the following things
cCState.pRefreshed = now()
ccstate.pModified = now()
?ccstate.pRefreshed
12/22/2010 4:50:48 PM
?ccstate.pModified
12/22/2010 4:51:01 PM
?ccstate.pRefreshNeeded
False
True
You can step through and watch the class perform. You can add the class anywhere that you need to
monitor a value modified by another user.
--
John W. Colby
www.ColbyConsulting.com