Refresh main form control when subform exited ?

M

mscertified

I have a main form containing a subform.
The subform lists checks received and when a new check is entered a 'balance
due' control on the main form needs to be adjusted. I'm having a hard time
getting this to happen. There only seems to be an 'enter' or 'exit' event for
the subform and neither seems to be of much use.
Does anyone know how to do this? Thanks.
 
B

Beetle

You should have a calculated control in your subforms footer, i.e.
txtBalance, that calculates the balance, and the control on your main
form should have a control source of;

=[YourSubformControlName].[Form]![txtBalance]

If you use the above method, you shouldn't need to do anything to
refresh the data in the main forms control. Make the calculated control
in the subform invisible if you don't want to see it there.
 
M

mscertified

That's exactly what I have and the value in the main form does not refresh
until you click in a control on the main form.
If the user presses the print button before doing this it prints the form
with the wrong amount.
I need the amount value to refresh as soon as you move from the amount field
in the subform.

Beetle said:
You should have a calculated control in your subforms footer, i.e.
txtBalance, that calculates the balance, and the control on your main
form should have a control source of;

=[YourSubformControlName].[Form]![txtBalance]

If you use the above method, you shouldn't need to do anything to
refresh the data in the main forms control. Make the calculated control
in the subform invisible if you don't want to see it there.
--
_________

Sean Bailey


mscertified said:
I have a main form containing a subform.
The subform lists checks received and when a new check is entered a 'balance
due' control on the main form needs to be adjusted. I'm having a hard time
getting this to happen. There only seems to be an 'enter' or 'exit' event for
the subform and neither seems to be of much use.
Does anyone know how to do this? Thanks.
 
M

mscertified

I did some more checking and here is what happens...
If you enter a new row in the subform and then go to enter another row, the
main form updates with the first row.
If you delete a row in the subform, the main form value updates immediately.
However, if you enter a single new row in the subform and then go back to
the main form, no update occurs until you click in a control.

-Dorian

mscertified said:
That's exactly what I have and the value in the main form does not refresh
until you click in a control on the main form.
If the user presses the print button before doing this it prints the form
with the wrong amount.
I need the amount value to refresh as soon as you move from the amount field
in the subform.

Beetle said:
You should have a calculated control in your subforms footer, i.e.
txtBalance, that calculates the balance, and the control on your main
form should have a control source of;

=[YourSubformControlName].[Form]![txtBalance]

If you use the above method, you shouldn't need to do anything to
refresh the data in the main forms control. Make the calculated control
in the subform invisible if you don't want to see it there.
--
_________

Sean Bailey


mscertified said:
I have a main form containing a subform.
The subform lists checks received and when a new check is entered a 'balance
due' control on the main form needs to be adjusted. I'm having a hard time
getting this to happen. There only seems to be an 'enter' or 'exit' event for
the subform and neither seems to be of much use.
Does anyone know how to do this? 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