T
Tom
I use the function below (&&&&&) to insert 3 fields into
a "history location" table after the date field has
changed.
The date field resides on a form while I the "history
location" table resides on the same form via a SUBFORM.
I am having a bit of a problem with refreshing the
location history information in real-time. When I change
the date, I am prompted with a message to acknowlege the
data dump into the location history table.
However, unless I move to another record (or close/re-
open the current record), I won't see the latest update
to the subform (location history table).
&&&&&&&& PROPERLY WORKING FUNCTION &&&&&&&&&&&&&&
Private Sub DateHistory_AfterUpdate()
On Error GoTo Err_DateHistory_AfterUpdate
strSQL = "INSERT INTO HISTORY (Record_ID,
DateHistory, Location) VALUES ('" & Me!Record_ID.Value
& "', #" & Format(Date) & "#, '" & Me!Location.Value
& "')"
MsgBox strSQL, , "Location history table will be
updated!"
CurrentDb().Execute strSQL, dbFailOnError
End_DateHistory_AfterUpdate:
Exit Sub
Err_DateHistory_AfterUpdate:
MsgBox Err.Description & " (" & Err.Number & ")", _
vbOKOnly + vbCritical
Resume End_DateHistory_AfterUpdate
End Sub
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Here's what I have attempted (unsuccessfully though):
1. Add line DoCmd.RunMacro "XYZ" after the 'CurrentDb()'
line. In the macro, the subform is opened, re-queryed,
then subformm is closed.
or
2. In the subform, requery the subform AfterUpdate
Again, both approaches don't give me the results as
expected... I won't see the new values in the "history
location" subform unless I close the current record or
navigate to another record back/forth.
Does anyone have some pointers as to how I should solve
this so that I can see the "dumped data" immediately
after I clicked OK to insert the records into the history
table.
Thanks in advance,
Tom
a "history location" table after the date field has
changed.
The date field resides on a form while I the "history
location" table resides on the same form via a SUBFORM.
I am having a bit of a problem with refreshing the
location history information in real-time. When I change
the date, I am prompted with a message to acknowlege the
data dump into the location history table.
However, unless I move to another record (or close/re-
open the current record), I won't see the latest update
to the subform (location history table).
&&&&&&&& PROPERLY WORKING FUNCTION &&&&&&&&&&&&&&
Private Sub DateHistory_AfterUpdate()
On Error GoTo Err_DateHistory_AfterUpdate
strSQL = "INSERT INTO HISTORY (Record_ID,
DateHistory, Location) VALUES ('" & Me!Record_ID.Value
& "', #" & Format(Date) & "#, '" & Me!Location.Value
& "')"
MsgBox strSQL, , "Location history table will be
updated!"
CurrentDb().Execute strSQL, dbFailOnError
End_DateHistory_AfterUpdate:
Exit Sub
Err_DateHistory_AfterUpdate:
MsgBox Err.Description & " (" & Err.Number & ")", _
vbOKOnly + vbCritical
Resume End_DateHistory_AfterUpdate
End Sub
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Here's what I have attempted (unsuccessfully though):
1. Add line DoCmd.RunMacro "XYZ" after the 'CurrentDb()'
line. In the macro, the subform is opened, re-queryed,
then subformm is closed.
or
2. In the subform, requery the subform AfterUpdate
Again, both approaches don't give me the results as
expected... I won't see the new values in the "history
location" subform unless I close the current record or
navigate to another record back/forth.
Does anyone have some pointers as to how I should solve
this so that I can see the "dumped data" immediately
after I clicked OK to insert the records into the history
table.
Thanks in advance,
Tom