Refresh/Repaint a subform

  • Thread starter Thread starter kev
  • Start date Start date
K

kev

Hi all:

I've got a subform that is loaded as a continuous form
with enough room to show 4 records and a vertical scroll
bar for >4. The first time the subform is made visible,
all is ok, it starts at the top. But, if you scroll to
the bottom of the subform, and call for the subform again
later, it starts where you left it, at the bottom. I'd
like to refresh or repaint the subform, but it is a
control, not a form, so I can't use these methods on it.
Any idea how to reset it?

Thanks for any help
 
kev said:
Hi all:

I've got a subform that is loaded as a continuous form
with enough room to show 4 records and a vertical scroll
bar for >4. The first time the subform is made visible,
all is ok, it starts at the top. But, if you scroll to
the bottom of the subform, and call for the subform again
later, it starts where you left it, at the bottom. I'd
like to refresh or repaint the subform, but it is a
control, not a form, so I can't use these methods on it.
Any idea how to reset it?

I'm not sure what you mean, exactly. You can *requery* the subform
using code like

Me!SubformControlName.Requery

and that may do what you want, at the expense of running the subform's
recordsource query all over again. Or maybe it would be enough to just
move to the first record on the subform, which you could do several
ways; here's one:

Me!SubformControlName.Form.Recordset.MoveFirst
 
Thanks, Dirk, your second one did the trick.

Don't know why this was happening, but on investigation I
found that it wasn't staying at the bottom of the list,
but instead it would open at the second record in the
list, so that the first was hidden at the top. Strange.
My subform is called by another subform, so maybe that has
something to do with it. Who knows...

Thanks, I didn't know that you could refer to the records
on a subform as a recordset! New possibilities!

Kev
 
kev said:
Thanks, Dirk, your second one did the trick.

You're welcome.
Thanks, I didn't know that you could refer to the records
on a subform as a recordset! New possibilities!

<g> Until Access 2000, you couldn't access the form's Recordset
directly, but only through the RecordsetClone. You could still do this
sort of thing back in Access 97, but it took another step involving the
Bookmark properties of the RecordsetClone and of the Form. Direct
manipulation of the form's recordset is tidier.
 
Back
Top