I wonder if anyone can help? With some forms I am using the open acDialog parameter to stop the code running whilst on the form, then when closing the form there is code to requery a control on the original form and this works fine.
However, I now have a scenario where I want to open one form from different forms and in different states eg.
This code runs from a button on subform QuotesSubform which is in a tab control on form CompaniesForm
stDocName = "QuotesForm"
DoCmd.OpenForm stDocName, , , , acFormAdd
Forms!QuotesForm.Form!CompanyID.DefaultValue _
= [Forms]![CompaniesForm]![CompanyID]
Forms!QuotesForm.Form.Modal = True
Forms!QuotesForm.Form!JobNumber.SetFocus
Now in this scenario I cannot use the acDialog parameter because I want to feed some properties/values to the form so that it opens as I want. The problem is I want to requery the original form. In the above case I would use the following code to run after update or on close of the form:
Forms!CompaniesForm!Quotessubform.Requery
If I put it in the form after update event it will only work if QuotesForm was opened from Quotessubform for example. But if opened from another form I would need different after update code to run.
Quotessubform is a continuous form with no edits, filters, additions, deletions allowed. I mention this because I've been playing with GotFocus and on Enter events to run the requery but without joy.
One alternative is to create lots of forms that open with the initial settings and close events that I want - but they would be difficult to administer.
Any ideas?
Thanks in advance. G. %-)
"If a job's worth doing, it's worth doing twice!"
However, I now have a scenario where I want to open one form from different forms and in different states eg.
This code runs from a button on subform QuotesSubform which is in a tab control on form CompaniesForm
stDocName = "QuotesForm"
DoCmd.OpenForm stDocName, , , , acFormAdd
Forms!QuotesForm.Form!CompanyID.DefaultValue _
= [Forms]![CompaniesForm]![CompanyID]
Forms!QuotesForm.Form.Modal = True
Forms!QuotesForm.Form!JobNumber.SetFocus
Now in this scenario I cannot use the acDialog parameter because I want to feed some properties/values to the form so that it opens as I want. The problem is I want to requery the original form. In the above case I would use the following code to run after update or on close of the form:
Forms!CompaniesForm!Quotessubform.Requery
If I put it in the form after update event it will only work if QuotesForm was opened from Quotessubform for example. But if opened from another form I would need different after update code to run.
Quotessubform is a continuous form with no edits, filters, additions, deletions allowed. I mention this because I've been playing with GotFocus and on Enter events to run the requery but without joy.
One alternative is to create lots of forms that open with the initial settings and close events that I want - but they would be difficult to administer.
Any ideas?
Thanks in advance. G. %-)
"If a job's worth doing, it's worth doing twice!"