Calling a variable from another form

R

rblivewire

I have three forms that all have variables in the vb code. The form
takes these variables from the field on one form and does a
calculation. I need to know how to call this variable that is holding
the solution so that I can post it on my 3rd form.
 
J

John W. Vinson

I have three forms that all have variables in the vb code. The form
takes these variables from the field on one form and does a
calculation. I need to know how to call this variable that is holding
the solution so that I can post it on my 3rd form.

It's a lot simpler to use a reference to the form itself, rather than storing
the value in a variable: [Forms]![NameOfForm]![NameOfControl]

If you really want to use a variable, put a line

Public variablename As Integer

(or whatever datatype) at the very top of a Module in the modules tab. This
public variable will be available from any form in the database, to read or
write.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top