refresh

J

John MilburySteen

Hi Access Gurus,

In A2003 I have a form (called Students) containing a subform (called
Classes). These are the classes that a given student is enrolled in. In
the Classes subform there is a field called Class. This field contains a
pulldown of possible classes to choose and in the pulldown beside each class
is the number of students enrolled already. This makes it easy for a user
to assign a student to the smaller section of a class to keep the numbers
more or less equal. A query generates the totals in the pulldown.

I cannot find a way to make the query run again to refresh the totals on the
pulldown after a student has been added to a class. On the top menu,
Records --> Refresh works fine, but I need a macro to refresh the totals On
Update.
I have tried a macro that calls requery and repaint, but requery and repaint
Class doesn't work. What to do?
 
S

Steve Schapel

John,

If you are using the After Update event of the Class combobox, this is
probably too early for the recalculation to be done. The reason for this is
that the new enrolment has not yet been saved to the table.

You could put a RunCommand/SaveRecord action at the beginning of the macro.
This should work, as long as there are no validation rules or whatnot that
still need to be satisfied before a valid record can be created. After
that, a Requery of the combobox should do the trick I think.
 
J

John MilburySteen

You were right with RunCommand. RunCommand Refresh After Update event did
the trick. Many thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top