473,386 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Passing variables between Forms

38
is there a way to pass variables between forms? for example have one form calling another one and passing a value to it.
Thanks for your help.
Salzan
Feb 10 '08 #1
8 10696
MMcCarthy
14,534 Expert Mod 8TB
If both forms are open then you can reference a control on formA from formB as follows:

Forms![formA]![ControlName]
Feb 10 '08 #2
salzan
38
Thank you................................
Feb 10 '08 #3
missinglinq
3,532 Expert 2GB
Another way would be to use OpenArgs.

From you first form:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "SecondFormName", , , , , , "ValueToPass"
  2.  
In your second form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.   If Len(Nz(Me.OpenArgs, "")) > 0 Then
  3.       Me.YourControlName = Me.OpenArgs
  4.   End If
  5. End Sub
  6.  
With Mary's method your first form must stay open until the value's been passed.

Welcome to TheScripts!

Linq ;0)>
Feb 10 '08 #4
MMcCarthy
14,534 Expert Mod 8TB
Very true Linq ... :)
Feb 10 '08 #5
salzan
38
Very true Linq ... :)
THNAKS A MILLION........

One more question, I assume I need all the commas to get to openarg, correct?
Feb 10 '08 #6
missinglinq
3,532 Expert 2GB
Hey, Mary! My ISP's going nuts tonight; you hadn't answered when (20 minutes ago) I clicked "Send!"

;0)>
Feb 10 '08 #7
missinglinq
3,532 Expert 2GB
Yes! They're "place holders" for arguments that aren't being used here. You can omit optional arguments, but if you use an argument that appears to the right of them, you have to include the comma(s) for missing ones.

Linq ;0)>
Feb 10 '08 #8
MMcCarthy
14,534 Expert Mod 8TB
Hey, Mary! My ISP's going nuts tonight; you hadn't answered when (20 minutes ago) I clicked "Send!"

;0)>
Never a problem, your answer was better than mine anyway.
Feb 10 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jason Us | last post by:
Does anyone have experience with passing variables from an ASP page to a JSP page. The way it currently works in passing the SSN in the URL. This cannot be good. I thought that storing a...
2
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text,...
5
by: Jack | last post by:
Hi, I need to pass multple variables in a link in order to go to a asp page with the two varables. The following are the values of the variables using response.write: <%'Response.Write Mypage...
9
by: Max | last post by:
I'm new with Javascript and can't seem to figure out what I'm doing wrong here as I'm not able to pass a simple variable to a function. In the head of doc I have: <script...
3
by: SV | last post by:
Dear all, In my application I have a lot of hidden fields. I want to make them invisible for the users though for debugging reasons I want to make them visible. So I want to add these objects to...
2
by: Michael C | last post by:
What's the best wat to pass data between two separate forms. For instance, Form1 invokes Form2 like this: Form z = new Form2(); z.Show(); How can I pass back strings and boolean values from...
11
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
7
by: The Doctor | last post by:
A rather elementary question, In VB5, how can I pass a variable from one form to another?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.