0

I have a string variable assigned a value in Form1, but wish to use this variable (and the same value) in another form within the database (e.g. Form2).

How can this be achieved?

Erik A
  • 31,639
  • 12
  • 42
  • 67
Dane I
  • 742
  • 9
  • 22

1 Answers1

0

You could create a global variable.

Declare it outside any procedures at the top of Form1, like this:

Public strYourVariable as String

Now, once you have assigned a value to strYourVariable, it will be available in other modules and forms.

The global variables will be reset if you:

  1. Use "End"
  2. Get an unhandled error
  3. Edit your VBA code
  4. Close Access
Community
  • 1
  • 1
Mark Butler
  • 895
  • 1
  • 5
  • 18