Solved

passing a value from one form to another

Posted on 1998-10-26
2
146 Views
Last Modified: 2010-04-30
I am building an application where, when a search button is clicked from any form, we get to a search form.  From here, I want to be able to pass the result to the original form where all the relevant fields for that record would get filled in text boxes.  How can I get back to the original form and how do I pass the value from Search form to original form.
0
Comment
Question by:bhavan
2 Comments
 
LVL 12

Accepted Solution

by:
jgv earned 100 total points
ID: 1441708
Add a Module to your project....select 'Project' - 'Add Module'. Declare any variables which should be visible to all forms within the module using the 'Global' declaration.

Global str as string
Global num as iteger
etc...

Use the hide/show to switch between forms.
Form1.hide          Form1.show

Declare a global variable that will indicate which form the search came from. Form1=1, Form2=2, Form3=3, etc. Make sure you udate the variable before proceeding to the 'search form'.
0
 
LVL 1

Expert Comment

by:wford
ID: 1441709
or better, if you set a type or an array in the search form as
public Results(0 to 4) as string

in your seach forma declare area, then you could referance these any where  (as long as your seach form is still loaded) by for example:

For n = 0 to 4
   text1(n) = frm_Search.Results(n)
next n
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 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…

825 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