Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send variables between access forms

Status
Not open for further replies.

696796

Programmer
Aug 3, 2004
218
GB
Hi,

I want to close one access form, open another and send the value of a variable stored from the first form to the second. Can I send the variable with the open command?

Thanks
 
Yes you can !

open form1 from form0

stropenArg="test"
DoCmd.OpenForm "form1", , , , , , stropenArg

get openArg from form1

if Me.OpenArgs ="test" then
'do stuff
end if

Other solution are to use functions, or global variables (usually not recommended).

 
i forgot an other way !

Example
Form0 is open, variable is iVariable

first open Form1
then pass the variable wherever you like (in a textbox - or maybe to a module - declared variable but haven't test it)

form1!txtInvisible.text=ivariable
then close form0

et voilà !

 
Hi,
Openargs will work, but its tricky when ure using much variables. otherwise the openargs are always strings so youve to transform em all the time...
try the global variables works better!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top