?
Solved

Can you trap when Jet refreshes a form with another user's edits?

Posted on 2012-09-01
13
Medium Priority
?
757 Views
Last Modified: 2012-09-01
I have a procedure on a bound detail form that sets up the form's calculated controls and button visiblity/captions depending on two status fields.

I am wondering if there is some way to trap when the jet/ace engine refreshes the form with another user's edits. Then I could check if either of the status controls have been changed--so that I can rerun the set-up procedure.

If not, does anyone know of any other way that I might achieve this?

Thanks in advance  :)
Shelley
0
Comment
Question by:shelldee
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38358055
A bit vague.  What do you mean by another user's edits?  Do you mean on a network with a shared database?  What setup procedures are you referring to?
0
 
LVL 31

Expert Comment

by:hnasr
ID: 38358076
When a user logs in , he will have a record with (id, date logged in, null)
With every relevant control edited, update date edited for that user (id, user, date logged, date edited)
When you log in , you will have a record with id, date logged in, null)
Read last record where user <> yourname and date edited > your log in date.
Set-up procedures.
0
 

Author Comment

by:shelldee
ID: 38358101
Sorry about that... :)

Environment is an Access 2010 backend with front ends on each user's machine.

The form is a single form which loads one record at a time. When the form loads, I have a form set-up procedure that runs.
The form has buttons and some information controls that change according to the values of 2 status controls. There is also a subform control that is loaded dynamically with the onChange event of a 'mock' tab control. Some of the tabs are not visible--again depending on the 2 status controls' values. The form set-up procedure determines how the form will look; what buttons are available to the user.

The user can change the item's status but this is determined by the form setup (ie. by which buttons are visible and what their captions are). If two users are looking at the same record, and one (say User 1) of them changes the item's status, when jet/ace refreshes the other user's form (User 2) to the new statuses, the button visiblity/captions, information controls, and tabs that can be visible would be wrong and would need to change.

I am wondering if there is a way to trap when jet refreshes the User 2's form with the status changes that were made by User 1.

I don't think that this will happen often, but I would like to know how to deal with it, because it could happen. I would prefer not to use a timer event to compare the statuses to the form setup-- and was hoping if you guys might have some ideas.

Hope this makes sense, and thanks again,
SD
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 600 total points
ID: 38358107
"I am wondering if there is a way to trap when jet refreshes the User 2's form with the status changes that were made by User 1."

I'm not of any way to trap the event.  One thing you could do is a Me.Refresh, which will immediately up date the current recordset with any changes made by other. Or, a Me.Requery which will add any new (or remove any existing) records to the current recordset.

mx
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 600 total points
ID: 38358111
I don't believe there is a way to send a refresh to other user's when a change is made in one database.  In order for the other users to see this, there needs to be a check to see if the data has changed by either refreshing or requerying your recordsource.  This can be done with a timer event but since you are opposed to this, the only other way I can think of is using another event first such as mouse move, or button click, to do a check first and then inform the user that the form will be refreshed because another user has made a change.
0
 
LVL 75
ID: 38358117
"I'm not of any way to trap the event."
I'm not aware of any way to trap the event.
0
 

Author Comment

by:shelldee
ID: 38358118
Thanks DatabaseMX, (and sorry to IrogSinta and hasnr for being too vague)

I was afraid of that. So I would probably need to either issue a Me.refresh and rerun the form's set-up procedure--either on a timer, or just have a button available for the user to click if they notice that the status controls have changed?

SD
0
 
LVL 75
ID: 38358123
Can't say this has even been an issue for me ... but hey ...

mx
0
 

Author Comment

by:shelldee
ID: 38358127
Thanks IrogSinta,

There is one set of status combinations where the buttons aren't available, but this is would be rare, so I think that your idea of using existing buttons to do the checks is a good one.

I'm not so much opposed to timer events -- it's just seems like maybe too much code for something that won't happen too often. If I used a timer, do you think that checking every 5 minutes is reasonable? (Probably difficult to answer without having context...) The user could be on this form, however,  a fair while, because it is a contains information or links to information for every aspect regarding the item.
0
 

Author Closing Comment

by:shelldee
ID: 38358137
Thanks DatabaseMX and IrogSinta :)

Both of your answers were excellent.
I'm good -- I don't need anymore of your time.

Thanks again, everyone for your attention,
Shelley
0
 
LVL 75
ID: 38358142
ok then ... let's call it happy hour time now !
It's happy hour time somewhere ...
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38358147
I wouldn't say that using the timer event would utilize too much coding.  As for the length of the timer event, that all depends on a variety of factors.  How long will the code that does the check run, if it takes less than a second to determine that a change has been made, I don't see a problem with checking it more often.  In one of my programs used by one of our departments, I have timer event on the main screen that runs every 3 seconds whenever the user has no other form open.  This main form is their dashboard where they see the statuses, queues, and messages.  Once they go into another tab on the main form or if another form opens up, the timer event doesn't run.  

I just gave you the above example so you can see that in certain instances, a short timer interval is fine.
0
 

Author Comment

by:shelldee
ID: 38358196
Thanks for the chuckle DatabaseMX!  :)  --keep me from going a little nuts, with how endless I seem to make all of this multi-user stuff...

And thanks for the example, IrogSinta. It's very helpful, esp since I've been quite leary of using timer events too heavily. When the form in question is first opened, nothing else is open (except for a very small hidden one for persistent connection). One of its links opens another detail form, but I could probably suspend the timer when it doesn't have focus. The code that does the check would be less than a second, I think, and if I set up a global constant for the timer length, it would be easy to change -- if needs be. And setting up the timer would be the most solid way of checking. (Thinking out loud here...)
Thank you for adding this!

Shelley
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question