Ra said:
I am still wondering how to update my subform more consistently. Not to
mention when I delete a record it shows the row as "deleted"
Are you deleting the record in code? Simply execute a requery on the
sub-form then
eg:
code to delete goes here:
me.frmMysubForm.Requery <--- add this after you delete code
(this assumed the
delete code is in the "main" form part..
Another issue is with a combo box on the same form. I have a list of names
in it, and when I delete one name it stays in the combo as "deleted" until
I
close and open the form
.....code to delete goes here:
....
me.NameOfComboBox.Requery <-- add this after your delete code
As a general rule, you want to learn the use of
me.Refresh - force a disk write, and display of all updated records,
(record pointer does NOT move)
I use me.Refresh just about anything I launch another form (or report) from
the current record, as then the current record is written to disk. Note
that forcing disk writes is a by-product of using me.Refresh, but I have use
it for years to force disk writes.
A good many developers recommend the following code to force a disk write of
the *current* record to disk:
if me.Dirty = true then
me.Dirty = false
end if
me.Requery - forms record set is re-loaded, same as if you closed the
form
and then re-opened it. Note that bookmarks are
invalid after
you do this
me.Repaint - pending screen updates are shown. So, if you have a
loop, or
code running, and you update a control on he
screen, it will NOT
generally display the update UNTIL your code
is done. Repaint
will display pending screen updates right away
me.ReCalc when you change a value in a form via the GUI, most
fields are
recalculated for you. When you change a value
via code, then
often, you need to do a re-calc. However, you
don't need this
when running code in "after update" events
etc, since those
events are running as a result of changes..and
thus recalc
is fired for you anyway.
DoEvents.
All pending screen, mouse, and repaint, and recalc events are fired.
the event stack is run till empty. Use this to "release" processing
during a loop in which you have a stop buttion, or keypress to
stop the loop...
So, after a bit of time, you instantly know *exactly* which of the above
commands you need to call. In your cause, requery of the sub-form, or combo
box will re-load the record set....exactly what the doctor ordered...