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

Using a variable to open a form

Status
Not open for further replies.

tonedeafdog

Technical User
Aug 1, 2005
3
US
Is there a way to use the value in a public variable to open a form with docmd.openform? I want to be able to pass both the name of the form to be opened, and return to the calling form; the latter will be different depending on what's being done in the database.
 
Hi

Do not understand the question, that is the code which the open a form button wizard generates, just take a look at that

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Sorry, I'll try to be more specific. Currently, I use this code to open the form Frm_EditCCBEsef:
DoCmd.OpenForm "frm_EditCCBEsef"

If I store the value "frm_EditCCBEsef" in the public variable "UseThisForm", what is the syntax (if any) that would allow me to use the variable instead of explicitly naming the form? If I try simply substituting the variable (e.g., DoCmd.OpenForm UsThisForm), I get error messages.
 
I get error messages
Very useful information.
Welcome to Tek-Tips.
Please take time to read the second FAQ in my signature.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi

The syntax is DoCmd.OpenForm UsThisForm

As PHV says you need to tell us what the error message(s) is / are we are not mind readers

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks. That format works. I didn't quote the error messages because I got different ones depending on how I wrote the line of code, and I couldn't get into the database at the time I was writing the message. Sorry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top