View Full Version : Need some serious HELP here.


Kenneth
06-16-2000, 03:10 AM
I have a form, with a record source with SQL.
In this form I have two subforms, each with a SQL query as the subform record source.
One of the two subforms is used as a reference. For example, the subforms tells me how many tonns of cargo is left on the ship. In the other subform I type in how many tonns I take out of the ship and how many I load into the ship. For each time I change the value (or enters a value) in the subform that tells me how many tons I take out or put in, I want the subform that displays the cargo tonns that are left on the ship. I need to update the subform from whithin the other subform. The focus is set on one subform and I need to update the second subform. I have tried for some time, with the requery function, but can not get it right. Please help me someone. Cause I could really need it. So I sleep better during the nights.

If you answer, THANK YOU VERY MUCH.

AlaskanDad
06-20-2000, 03:23 PM
You can always reference an open subform from anywhere using the following VB code example:

Forms![samplemainformname]![samplesubformname].Form.[sampletextbox].value

Kenneth
06-20-2000, 10:41 PM
Yes, I know. But that doesn't solve my problem. I need to refresh the underlying query behind the subform. And then go back to the first subform and continue the procedure.

AlaskanDad
06-21-2000, 06:50 AM
You may want to set the focus to that subform and refresh it:

Forms![samplemainformname]![samplesubformname].Form.[sampletextbox].SetFocus
Docmd.RunCommand acCmdRefresh

ingvar68
06-22-2000, 12:10 AM
i would like to offer other way:
in form where you change your value use:

Private Sub Form_AfterUpdate()
FORMS("MAIN_FORM_NAME")![WHAT_NEED_FORM_NAME].Form.Requery
End Sub
glad to answer