Passing variable back from form (help)

homer2002

Registered User.
Local time
Today, 17:00
Joined
Aug 27, 2002
Messages
152
How easy it it to pass a variable back from a form



for example i want to make my own Msgbox and I will need
to return the correct response.

so i can code like this (or almost)


Dim I as integer
i = docmd.openform "frmMyMsgbox"
if i = vbyes then msgbox "You pushed the yes button"


(obviously this only caters for the YES button and obviously this code is not going to work)
 
The easiest way is to declare a public variable in a module.
 
cheers, thats the way I do it at the moment although i was thinking of creating a single msgbox form that I can just copy and use from database to database.
 
You could also use the OpenArgs property of a form to pass information to a single message box form
 
As Mile indicated, you can use OpenArg, and another alternative is the Tag property. Set it with the value of the response, hide the form and then reference it from the other form.
 
Or use "property" procedures; you can set a value in a form and get it in other forms, queries, modules, etc.

Simpler and cleaner.

RichM
 

Users who are viewing this thread

Back
Top Bottom