Re: Live record counts

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



TOMAC wrote:

We have 2 MS Access front end guis we use to enter data into an MS Access
master table, stored in a llinked MS Access database on a shared network
drive. I want to be able to run a procedure/macro whenever the record count
in the master table increases. I can tell when I add a record to this table
becasue I hit the save record button. However, I need to run the same
procedure/macro when the other user updates the table too without exiting the
data entry gui.

Does anyone have any idea how I can tell if the master table has been
updated by the other user?

Not sure if this is the proper place to post this but thanks in advance to
anyone who can point me i teh right direction!


Without triggers, you would have to query the table to see
to see if the number of records has changed. If there is a
point where you need this information, then do it there. If
you want to monitor this asynchronously from your normal
activities, use a form's Timer event.

There are several ways to check the number of records in a
table, but this is pretty straightforward:

Static RecCnt
Dim NewCnt As Long
Dim rs As Recordset

Set rs = Currentb>OpenRecordset("SELECT Count(*) " _
& "FROM thetable")
NewCnt = rsFields(0)
rs.Close : Set rs = Nothing

If RecCnt <> NewCnt Then
' record added or deleted
' do something
RecCnt = NewCnt
End If

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • Re: Live record counts
    ... stored in a llinked MS Access database on a shared network ... I want to be able to run a procedure/macro whenever the record count ... in the master table increases. ... Access isn't a real client/server database, ...
    (microsoft.public.access.formscoding)
  • Re: Live record counts
    ... event can generate a LOT of unnecessary network traffic. ... in the master table increases. ... Dim NewCnt As Long ...
    (microsoft.public.access.formscoding)
  • Aggregates on DateTime fields
    ... I am storing a time in a Dattime field of a table in an ... Access database, and beginning to think this might be a mistake. ... details table and write it in the master. ... Does the Min aggregate work on DateTime fields? ...
    (borland.public.delphi.database.ado)
  • Change reference databases with VBA
    ... I have a 'master' Access database that is referenced to about ten other ... write a piece of VBA code that will allow me to update my references from one ... and the VBA code would now change my reference to filepath 1 from ...
    (microsoft.public.access.modulesdaovba)
  • Access 2000 replications
    ... I have inherited an access database and the person who was before me has ... I have already had to break to password on the Master as it ... My problem now is that there hasnt been a synchronisation ... between the replicas and the client Master for a long time. ...
    (microsoft.public.access.replication)