Call variable from one form to another

I'm working an application that is now requiring a little VBA.  I've been away from it too long to remember the details.  I need to use a variable created in one form (through the use of a command button) and recall the same variable in another form that will then insert it into a table.  I've included a snippet.  Very simple at this stage but I'm facin a brain freeze.
Who is Participating?
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
You can stick the variable in a module, then it will be globally visible within the application.

You can also define it as a global within a form and then access it from other forms.

There are a few other ways too, but those are the easiest.
KDWWAuthor Commented:
Interesting!  I'll need to experiment but looks promising.
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

I've included a snippet.
What snippet?
"form that will then insert it into a table"
If interested in the value to insert in a table, then you can pass it as OpenArgs in the OpenForm.

DoCmd.OpenForm "otherForm", acNormal, , , , , "1234"

You can use the value in otherForm:
tableValue = Me.OpenArgs
KDWWAuthor Commented:
Just what I needed!  Thank you capricorn1!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.