Solved

Finding a form's parent

Posted on 1998-09-01
4
131 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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA open file from excel cell 4 36
VBA saving file message display 5 56
Question about INSTR  - need to extract data MS ACCESS query 6 54
Problem to With line 4 42
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 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

12 Experts available now in Live!

Get 1:1 Help Now