not_rich_yet
Registered User.
- Local time
- Today, 05:30
- Joined
- Mar 19, 2002
- Messages
- 39
Hi all,
I have a subform which can be opened via a button from numerous main forms. I need to access the main form from the subform to update a value on the main form based on what the user has done with the subform.
I created a textbox on the subform, which gets it's text value set when the button from the main form is clicked. I have it to set the text to the name of the main form from which it was clicked....this works fine, as I can see the name of the main form appearing in the tet box.
I then attempted numerous times to get the following code working, to allow me to update a value on the main form, the code was placed in the Form>Close property of the sub form(s)
Dim strOpenedFrom As String
Me!txtOpenedFrom.SetFocus
strOpenedFrom = txtOpenedFrom.Text
Forms(strOpenedFrom).AppPrice.SetFocus
Forms(strOpenedFrom).AppPrice = Forms(strOpenedFrom).AppPrice + Form_ClientPurchase.Total
Access tells me it cannot find the form I have referred to, even though the text going into the text box on the subform is exactly the same name as used by the code in numerous other places...
Am I missing something here?
Cheers,
nry
I have a subform which can be opened via a button from numerous main forms. I need to access the main form from the subform to update a value on the main form based on what the user has done with the subform.
I created a textbox on the subform, which gets it's text value set when the button from the main form is clicked. I have it to set the text to the name of the main form from which it was clicked....this works fine, as I can see the name of the main form appearing in the tet box.
I then attempted numerous times to get the following code working, to allow me to update a value on the main form, the code was placed in the Form>Close property of the sub form(s)
Dim strOpenedFrom As String
Me!txtOpenedFrom.SetFocus
strOpenedFrom = txtOpenedFrom.Text
Forms(strOpenedFrom).AppPrice.SetFocus
Forms(strOpenedFrom).AppPrice = Forms(strOpenedFrom).AppPrice + Form_ClientPurchase.Total
Access tells me it cannot find the form I have referred to, even though the text going into the text box on the subform is exactly the same name as used by the code in numerous other places...
Am I missing something here?
Cheers,
nry