Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

passing a value from one form to another

Posted on 1998-10-26
2
Medium Priority
?
150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
jgv earned 200 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

618 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