Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Access only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
Access
Passing variables between Forms
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
salzan
New Member
Join Date:
Feb 2008
Posts:
38
#1
Passing variables between Forms
Feb 10 '08, 10:14 PM
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
MMcCarthy
Recognized Expert
MVP
Join Date:
Aug 2006
Posts:
14387
#2
Feb 10 '08, 10:52 PM
If both forms are open then you can reference a control on formA from formB as follows:
Forms![formA]![ControlName]
Comment
Post
Cancel
salzan
New Member
Join Date:
Feb 2008
Posts:
38
#3
Feb 10 '08, 11:06 PM
Thank you............ ............... .....
Comment
Post
Cancel
missinglinq
Recognized Expert
Specialist
Join Date:
Nov 2006
Posts:
3533
#4
Feb 10 '08, 11:08 PM
Another way would be to use
OpenArgs
.
From you first form:
[CODE=vb]DoCmd.OpenForm "SecondFormName ", , , , , , "ValueToPas s"
[/CODE]
In your second form:
[CODE=vb]Private Sub Form_Load()
If Len(Nz(Me.OpenA rgs, "")) > 0 Then
Me.YourControlN ame = Me.OpenArgs
End If
End Sub
[/CODE]
With Mary's method your first form
must
stay open until the value's been passed.
Welcome to TheScripts!
Linq
;0)>
Comment
Post
Cancel
MMcCarthy
Recognized Expert
MVP
Join Date:
Aug 2006
Posts:
14387
#5
Feb 10 '08, 11:10 PM
Very true Linq ... :)
Comment
Post
Cancel
salzan
New Member
Join Date:
Feb 2008
Posts:
38
#6
Feb 10 '08, 11:14 PM
Originally posted by
msquared
Very true Linq ... :)
THNAKS A MILLION........
One more question, I assume I need all the commas to get to openarg, correct?
Comment
Post
Cancel
missinglinq
Recognized Expert
Specialist
Join Date:
Nov 2006
Posts:
3533
#7
Feb 10 '08, 11:14 PM
Hey, Mary! My ISP's going nuts tonight; you hadn't answered when (20 minutes ago) I clicked "Send!"
;0)>
Comment
Post
Cancel
missinglinq
Recognized Expert
Specialist
Join Date:
Nov 2006
Posts:
3533
#8
Feb 10 '08, 11:35 PM
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)>
Comment
Post
Cancel
MMcCarthy
Recognized Expert
MVP
Join Date:
Aug 2006
Posts:
14387
#9
Feb 10 '08, 11:56 PM
Originally posted by
missinglinq
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.
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment