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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return A Value From A Form? 1

Status
Not open for further replies.

tomh1

Programmer
Feb 6, 2004
13
0
0
US
I would like to be able to have a form return a value to another form, in much the same way that msgbox() and inputbox() do. Is there any way to do this?

Some more specifics:

I don't want to use msgbox() or inputbox() because of the type of data I'm trying to collect. The return value will be fairly simple (initially, it would just be true or false), but will have different results in the calling forms.

Suppose there's some forms, Form1, Form2, Form3,... I want to call Form2 from other forms to validate some data entry. For instance, Form2 might ask the user for a password. If the user enters the right password, then the calling form (Form1) stores some data; if the password is wrong, Form1 rejects the data. If the calling form is Form3, then a correct password would result in the opening of Form4.

Thanks!
 
Check the syntax of OpenForm and use OpenArgs (can't remember now how many commas must be entered).
This will write to the OpenArgs property of the form you open and you can use it for the 'lifetime' of the form:

varSomeVariable = Me.OpenArgs


Good luck


[pipe]
Daniel Vlas
Systems Consultant

 
Thanks, Daniel, but I don't see how that would work.

Using OpenArgs I can pass arguments from the calling form (Form1) to the opened form (Form2), but I don't understand how the openargs property of the form that I open (Form2) helps me pass data back to the calling form (Form1).

I'm probably missing something "obvious," here.

Not to make things more difficult than they need to be, but I would prefer if Form2 would return a value when it was closed, and not before (so I don't have to have any values "lying around" where they might be exposed to snooping).

- Tom Hopper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top