Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Finding a form's parent

Posted on 1998-09-01
4
Medium Priority
?
141 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
ID: 1432429
Edited text of question
0
 
LVL 4

Accepted Solution

by:
tomook earned 300 total points
ID: 1432430
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
ID: 1432431
Thanks.  I am setting mCallingForm to the form instead of a string.
0
 
LVL 4

Expert Comment

by:tomook
ID: 1432432
Even better.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

916 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