iamdaedal
asked on
Access -- Close a form and return to the form that called me
I have a record detail form that can be invoked from any of three other forms. How do I code to correctly restore the form that invoked it when I exit?
ASKER
I was not able to get the OpenArgs solution to work, and ran out of time on my project delivery date to try to ramp up to a sufficient understanding to implement it. Add to that the fact that I don't understand the Nz function, even after reading as much about as I could find here and on MS's documentation. I left the idea behind and found a simpler solution that fit my limited skills and kept me on track with my deadlines. Will try to revisit this when time and opportunity permit.
Thanks to LMSConsulting for your offering. Oh, and sorry for the delay in responding. Been seriously out-of-pocket for a while and unable even to open up the laptop... :/
Thanks to LMSConsulting for your offering. Oh, and sorry for the delay in responding. Been seriously out-of-pocket for a while and unable even to open up the laptop... :/
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for iamdaedal's comment #a39584297
for the following reason:
Went with a solution that didn't require an understanding of this concept and no longer require the answer.
Accepted answer: 0 points for iamdaedal's comment #a39584297
for the following reason:
Went with a solution that didn't require an understanding of this concept and no longer require the answer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Voicing an 'objection' is stronger than I imagine is called for. Certainly I had issues with the solution as originally provided and my circumstances didn't allow for me to engage in an open debate about its relative merits, especially since I hadn't seen his amended solution until just now. Will try this newly formed solution and come back with my findings...
daedal
daedal
DoCmd.OpenForm "CalledForm", , , , , , Me.Name
This passes the name of the "callingform" in the OpenArgs section. You'd then have to store that name somewhere in the "calledform". You could add a hidden textbox to your form (name it "txCallingForm"), and then do this in the Form's Open event:
Me.txCallingForm = Nz(Me.OpenArgs,"")
Finally, in the Close event of the form:
If Nz(Me.OpenArgs, "") <> "" Then
Forms(Me.txCallingForm).Se
End If