Help refresh data

F

Fjordur

Hi,
A 'test' is a list of questions. Each question has a grade (a number). I can
display a 'test' form with questions subform and display the average grade
of the test, updated whenever a grade is modified. So far so good.
I have a 'person' form with a subform that lists 'tests' with date and
average grade. I have programmed the double click on the subform to open the
test form. There, you can modify grades. My problem is when you close the
test form, the average doesn't refresh on the test subform of person form. I
guess I should do a requery but can't find how to trigger it (should be when
the test form is closed).
Can't remember how to solve this one
Thanks for your help
 
G

guido via AccessMonster.com

In the 'On Close' event of your test form, put code like:
Forms("Frm_Person").Requery
 
F

Fjordur

guido via AccessMonster.com said:
In the 'On Close' event of your test form, put code like:
Forms("Frm_Person").Requery
Thanks Guido,
the problem with above solution is, sometimes my 'test' form is opened by
itself , not from the 'person' form. Or it could be opened from another form
in the future. That's why I was trying to solve the problem from the
'person' form side.
Would it be possible to write a general purpose code that I'd call from the
on close event of [possibly all] forms, that would
- find out which form is open just behind the form that's being closed
- requery it ?
 
F

Fjordur

Fjordur said:
guido via AccessMonster.com said:
In the 'On Close' event of your test form, put code like:
Forms("Frm_Person").Requery
Thanks Guido,
the problem with above solution is, sometimes my 'test' form is opened by
itself , not from the 'person' form. Or it could be opened from another form
in the future. That's why I was trying to solve the problem from the
'person' form side.
Would it be possible to write a general purpose code that I'd call from the
on close event of [possibly all] forms, that would
- find out which form is open just behind the form that's being closed
- requery it ?
OK, answering question above, I wrote
Public Function requeryPreviousForm()
If Forms.Count > 1 Then Forms(Forms.Count - 2).Requery
End Function
which can be called fom the 'on close' of any form
Is that OK or did I miss some trap?
 
G

guido via AccessMonster.com

It seems like that should work. I can't think of any potential traps.
 

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