Requery

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

Hi. This might seem like a dumb question, but. When is a good
time to requery a form when one adds a new record. Should the
requery come in the afterupdate (just don't seem right?). Should I
use a command button to trigger a requery?

Thanks,
James
 
Hi. This might seem like a dumb question, but. When is a good
time to requery a form when one adds a new record. Should the
requery come in the afterupdate (just don't seem right?). Should I
use a command button to trigger a requery?

Thanks,
James

Why requery at all? Access does so for you automatically, when you
move off the record.

What are you trying to accomplish with the requery?

John W. Vinson[MVP]
 
I have a list box which, for example, is populated with movie titles. The
form is based on the same table and has all fields displayed for
editing or adding data. When I add a record I need to have the list box
show the new record.

James
 
You don't want to requery the form. You want to requery the listbox control.

The best time to do that is probably in the after update event of the form.
Depending on what is shown in the listbox and the number of records, you may
want to add some degree of control on whether or not to requery the list. That
is you might want to requery only when certain values are changed or only when a
new record is added/deleted.

By the way the way to requery the listbox would be

Me.NameOfListbox.Requery
 
Back
Top