473,382 Members | 1,252 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,382 software developers and data experts.

How to Pass variable value from one form to another

134 100+
I have no exactly idea how to pass a variable value from one form to another, How do I do it using, say in Form 1 using DoCmd.OpenForm like the below statement, correct me If I am wrong.

FORM_1
Dim msg As String
strlsql = "Hello"
DoCmd.OpenForm "frmPO", acViewNormal, , msg

Then on the 2nd Form -FORM_2, Should I detect it from the Form_load ? .

FORM_2 (Form_Load)

IF msg = 'bla bla" then
do this ...........................

Endif
Dec 26 '06 #1
2 3908
missinglinq
3,532 Expert 2GB
You use the last argument of the OpenForm command, openargs. strMessage is assigned to openargs in Form1, then retieved in Form2

Expand|Select|Wrap|Line Numbers
  1. 'On the first form 
  2. Private Sub Goto2ndForm_Click()
  3. Dim strMessage as String    
  4.    strMessage = "bla bla" 
  5.    DoCmd.OpenForm "2ndForm", , , , , , strMessage
  6. End Sub
  7.  
  8. 'On the second form
  9. Private Sub Form_Load()
  10.     If OpenArgs = "bla bla" Then
  11.       'Do whatever
  12.     End If
  13. End Sub
Dec 26 '06 #2
jamesnkk
134 100+
You use the last argument of the OpenForm command, openargs. strMessage is assigned to openargs in Form1, then retieved in Form2

Expand|Select|Wrap|Line Numbers
  1. 'On the first form 
  2. Private Sub Goto2ndForm_Click()
  3. Dim strMessage as String    
  4.    strMessage = "bla bla" 
  5.    DoCmd.OpenForm "2ndForm", , , , , , strMessage
  6. End Sub
  7.  
  8. 'On the second form
  9. Private Sub Form_Load()
  10.     If OpenArgs = "bla bla" Then
  11.       'Do whatever
  12.     End If
  13. End Sub
Thanks so much, got your message, it working now.
Dec 26 '06 #3

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

Similar topics

5
by: Seeker | last post by:
Newbie question here... I have a form with some radio buttons. To verify that at least one of the buttons was chosen I use the following code ("f" is my form object) : var btnChosen; for...
1
by: carmen | last post by:
I am using the code below to open another page depending on what is selected. This is working ok but I would like to streamline it so that I will hot have to create a page everytime a new category...
110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
3
by: Lyn | last post by:
Hi, I have been experiencing a problem passing a LIKE statement in the WHERE argument of a DoCmd.Openform statement. I have posted that issue separately. However, in an attempt to work around...
3
by: Martin | last post by:
I have a calendar form that sends the inputted date back to a text box . Using the GET method, I would like to pass the date as a variable to another asp page. How do I do this? Thanks.
1
by: drec | last post by:
I need to pass a variable from script1.php to script2.php. The problem is that these scripts use frames and therefore I am able to pass the variable through the URL. It also does not use forms to...
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
9
by: JRough | last post by:
I tried to pass the $result from a mysql_query in a url like this line Header("Location:clm_historyXL.php?_result=".$result); but on the redirect location clm_history.php page I get an error on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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...

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.