Need some serious HELP here.

Kenneth

Registered User.
Local time
Today, 20:36
Joined
May 31, 2000
Messages
10
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.
 
You can always reference an open subform from anywhere using the following VB code example:

Forms![samplemainformname]![samplesubformname].Form.[sampletextbox].value
 
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.
 
You may want to set the focus to that subform and refresh it:

Forms![samplemainformname]![samplesubformname].Form.[sampletextbox].SetFocus
Docmd.RunCommand acCmdRefresh
 
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
 

Users who are viewing this thread

Back
Top Bottom