Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
passing a value from one form to another
Joe Camilleri 

16 years ago
I need to pass a variable from one form to another. I am using the OpenArgs argument. In my FormA I have a textbox named Name. In it I also have a button with an onClick event procedure
"DoCmd.OpenForm "FormB", acNormal, , , , acWindowNormal, "abc4"

abc4 is any text which the user inputs.

In FormB (the other form were i want to pass the variable ) has an onload event "Me.NameB = Me.OpenArgs".  
NameB is the name of the text box that I want the variable to be written to.
As it is, the FormA manages to pass the string abc4 to FormB, but what i cannot manage to do is that instead of passing just abc4, i want to pass anything the user writes in textbox NameA in FormA.


Reply from Richard Rost:

Let me make sure I understand this correctly. You have FormA with a text box on it. I'll name your textbox NameA because "Name" is a reserved keyword in Access and you shouldn't use it for any of your objects. When the user clicks on a button on FormA, you want FormB to open, and then the value of NameA gets copied to NameB. Is that right? If so, here's how you do it in your button's OnClick event:

Docmd.OpenForm "FormB"
Forms!FormB!NameB = NameA

That's it. That's all you need. For more help with this concept see my tutorial on referring to a value on a different form.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 8/12/2026 4:00:10 PM. PLT: 1s