Solved

Finding a form's parent

Posted on 1998-09-01
4
130 Views
Last Modified: 2010-04-30
I have a form,VendorInformation, that can be shown from two other forms,Requisitions and Purchase Orders, and a menu option, Vendor Maintenance.  Before I show the VendorInformation form from either the Requisitions or the Purchase Orders form, I hide the calling form.  Before I unload the VendorInformation form, I want to show the Requisitons or the Purchase Orders form.

How do I determine which form, Requisitions or Purchase Orders, called the VendorInformation form?
0
Comment
Question by:baileys
  • 2
  • 2
4 Comments
 

Author Comment

by:baileys
Comment Utility
Edited text of question
0
 
LVL 4

Accepted Solution

by:
tomook earned 100 total points
Comment Utility
The simplest method, which avoids API calls, is to add a property to VendorInformation which tells it which form called it. For example, insert the following in VendorInformation:

Private mCallingForm As String

Public Property Let CallingForm(Value As String)
  mCallingForm = Value
End Property

Public Property Get CallingForm() As String
  CallingForm = mCallingForm
End Property

When you are closing VendorInformation, merely check the value of mCallingForm to determine to which form you should return.

In each calling form (Purchase Orders, Requisitions), use this calling convention
  VendorInformation.CallingForm = "PurchaseOrders"
  VendorInformation.Show
Or:
  VendorInformation.CallingForm = "Requisitions"
  VendorInformation.Show

The first reference to any property of a form loads the form, but it will not be visible until the method Show is called. Please forgive any typos.
0
 

Author Comment

by:baileys
Comment Utility
Thanks.  I am setting mCallingForm to the form instead of a string.
0
 
LVL 4

Expert Comment

by:tomook
Comment Utility
Even better.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now