Microsoft
Software
Hardware
Network
Question : Multi User Development in MS Access
Hi, I have a VB.NET 2003 application that has multiple forms and uses an MS Access database to store data. Some forms use hard coded connections with dataTables and some forms use the the connection wizard type of connections and employ both dataTables and dataSets.
Multiple instances of the application can run and connect back one MS Access data source without any major issues. The data source is updated on a "last change wins" type of connection (to avoid concurrency violations), where the last change that is made to a particular record becomes the permanent change regardless of who made it and when.
The situation we're seeing (and we're not sure if this is best practice) is when 2 or more users open the same form and edit records therein. The final changes are not reflected until the form is reloaded for each user and the dataTables are refilled with all the new updates. To make this a bit more clear, below is a simple scenario that illustrates our situation:
User1 on Computer1 opened the Personnel form and finds 10 different records.
User2 on Computer2 opened the Personnel form and finds 10 different records.
User3 on Computer3 opened the Personnel form and finds 10 different records.
'
User1 adds 3 new records to the database.
User1 can see all 13 records.
'
User2 only sees 10 records until he/she closes the Personnel form and reopens it. Then they can see all 13.
Unless User2 reloads the form, he/she can navigate around the form all day and not see the 3 new records.
'
User2 deletes record # 4, but User1 and User3 will not know about it until he/she reloads the form.
'
User3 only see the original 10 record, because they have not closed and reopened the Personnel form.
Clearly, the reason is because they have 3 different dataTables in memory and those dataTables are not getting updated with the new changes to the data source until a new "Fill" command is performed.
Is there a "best practices" way of keeping the data current for all users? Or is "you'll get the updates when you reopen the form" an appropriate way of handling this?
How do developers handle multi user environments that need to be refreshed in the MS Access arena.
Any suggestions are appreciated, as I would like to learn a proper ("best practices") way of handling such a scenario.
Thanks,
FDT
Answer : Multi User Development in MS Access
Agree with Raynard7:
Personnally, I use a combination of custom database auditing and a form timer to check if there have been any audited inserts made since the last synchronization.
Each time a user selects, inserts, modifies, deletes, opens a form, closes a form, a record is written to an auditing database (which each user is connected to via linked tables). The audit record contains:
AuditTypeID - one of (Open, Close, Select, Insert, Update, Delete): Open & Close include the name of the Form Opened/Closed, Selects audit the SQL of the query, Inserts, Updates & Deletes give full details of the field values of records added, modified, deleted as the case may be.
ComputerName - name of client computer from where audit was made.
UserID - name of logged on user.
AuditDateTime - Date/Time of audit.
The auditing is done via a class module which can be instantiated as needs be.
In forms where I need to see new Inserts, I would have a Timer event on the form (maybe interval of 60000 - 1 minute)
In the Timer Event of the form, I would have:
Private timeLastSynchronized As Date
In the Form_Open Event handler
timeLastSynchronized = Now()
In the Form_Timer event
Private Sub Form_Timer()
Dim rs As DAO.Recordset
Set rs = CurrentDB().OpenRecordset(
"SELECT * FROM tbl_audit_event WHERE ((AuditDateTime) > #" & Format(timeLastSynchronize
d, "dd/mm/yyyy hh:nn:ss") & "#);"
If (Not rs.EOF) Then
' new records
Me.Requery
timeLastSynchronized = rs("AuditDateTime")
End If
rs.Close
Set rs = Nothing
Timer = 60000
End Sub
Random Solutions
Cannot open database -- VBA Project corrupt
restoring database window
Sort a SortedDictionary based on value, not key - C#.net MVC
How to find out who has an Access 2003 database locked
Microsoft, Office, 2007, Change User Menus & interfaces to English
I need to strip out every vbCrLF from a field
Error upgrading AD schema
VBA Loop through record names
Seeking an example database that uses ADO coding
Batch file for copying folder named as yesterday