Mark said:
I think the problem is that the lost focus is only applicable to
within the one instance of Access.
One option that comes to mind would be to change the default refresh
rate on the forms load event and set back to normal when the form is
closed.
i.e.
'Set a form level variable to store the Current Refresh
Dim intInterval As Integer
Private Sub Form_Load()
'Store refresh interval
intInterval = GetOption("Refresh Interval (sec)")
'Set to 1 second
Application.SetOption "Refresh Interval (sec)", 1
End Sub
Private Sub Form_Close()
'Restore to original setting
Application.SetOption "Refresh Interval (sec)", intInterval
End Sub
There may be a performance issue here because Access is forced to
refresh the form every second!
I don't believe that the automatic form refresh controlled by the
Refresh Interval setting will cause the saving of a dirty record. A
quick test appears to confirm this. I suspect that doing what
RobGMiller is asking will require using API calls to hook the Access
application window and trap a particular window message. This is not an
area I know much about, unfortunately.
It seems to me that it should be possible for the Access instance that
is receiving the focus (call it "instance A") to automate the other
Access instance ("instance B") and instruct it to save the record.
Instance A wouldn't necessarily need to know whether it has just
received the focus, but it might know when it is about to do something
that will require instance B to have saved the record, and so it could
go ahead and tell B to do so.