Tom,
I have encountered this issue just recently and have devised the following
method to help me cope with it.
On the invocation of the form (i.e., the request to open), I have coded the
following:
DoCmd.OpenForm strFormToOpen, , , strLinkCriteria, , , strProcessText &
"/" & Me.Name
The key is in the OpenArgs parameter of the OpenForm statement. At the end
I've included the string that I want to appear in the new form's caption, a
divider slash, and the name of the invoking form (the parent, if you will).
In the called form's Open event, I review the OpenArgs and obtain the
appropriate information:
strOpenarg = Nz(.OpenArgs, "")
intPos = InStr(strOpenArg, "/")
If intPos > 0 Then
strParentForm = Mid$(strOpenArg, intPos + 1)
strOpenarg = Mid$(strOpenArg, 1, intPos - 1)
End If
!lblCaption.Caption = strOpenArg
Then in the form's Close event (although Allen Browne, Microsoft MVP,
recommends the AfterUpdate event [see newsgroup question from 11/17/2008]),
I've included code similar to the following:
' Ensure the underlying form gets refreshed with new/updated records...
Select Case strParentForm
Case "frmSpecificFormA"
Set frmMainForm = Forms!frmSpecificFormA
Case "frmSpecificFormB"
Set frmMainForm =
Forms!frmSpecificFormB!isubfrmSomethingList.Form
Case Else
Set frmMainForm = Forms!frmSpecificFormC
End Select
frmMainForm.Requery
frmMainForm.Refresh
Set frmMainForm = Nothing
So far, this seems to have worked for me. Hope it helps!
Larry
"Tom" <(E-Mail Removed)> wrote in message
news:00173219-1c6a-41c5-bf3a-(E-Mail Removed)...
Form Management
Hi! I’m in the midst of developing an Agreements database (contracts,
subcontracts and the like) and am having form management issues.
Basically, I have 3 main tables – Agreements, Companies and Contacts
(others too, but these three will suffice for my discussion below).
When opening the database, the first form is Main Menu with buttons to
access a continuous form showing records for each table (i.e.,
frmAgreementList, frmCompanyList and frmContactList).
From these list forms, the user can double click to open a detail form
for a specific record (frmAgreement, frmCompany, frmContact). The
double click hides the list form and opens the detail form to the
correct record. All well and good so far.
My problem is managing the forms when crossing from one detail form to
another. For example, the user might open the frmCompanyList, select
a specific company and open the frmCompany. On frmCompany is a
subform showing all the agreements with said company. Double Clicking
on one of the listed agreements opens frmAgreement to the proper
record. On the frmAgreement is a list of contacts. Double Clicking
on one opens frmContact to the proper record.
So what happens when the user closes frmContact? User expectation is
that the database will navigate back to the last form viewed, in this
case frmAgreement (incidentally requerying the data so the Contact
information on the subform is updated). Similarly, closing
frmAgreement would send the user back to frmCompany. Basically, a
cascading arrangement till eventually the user is back to the main
menu.
How does one implement such a cascading system considering there are a
multitude of paths that could be followed to get to any of the detail
forms? I’ve tried a home grown solution once in the past, and it was
a marginally unsatisfactory experience.
Does anybody have any good examples they can point me towards? Or is
this type of cascading arrangement unmanageable? If so, what
alternate would you suggest.
Thanks!
|