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

How to insert the contents of a memvar in from reference?? 1

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
Will someone show me how to insert the contents of a memvar into a form reference line of code. See below:

memvar = "AR Customer Listing"

Forms![Main Tabs]![contents of memvar goes here].SetFocus
"Forms![Main Tabs]![" & memvar & "].SetFocus" (This is just to give you more of any idea of what I need.

Steve
 
This should work:
Forms![Main Tabs].Controls(memvar).SetFocus
 
Thanks for the quick reply but, I got an error message because Access thinks that the contents of the memvar is a control of the {Main Tabs} form. I should have been more specific. The memvar holds the name of a screen such as: Forms![Main Tabs]![Sales Screen].SetFocus.

Thanks again. I hope you can still help me. You deserve a star!

Steve G.
 
I am sorry, but I still do not quite understand. You first example shows:
memvar = "AR Customer Listing"
But in your secondpost, you say memvar is:
Forms![Main Tabs]![Sales Screen].SetFocus

Here are two thoughts:
Me.TabCtl0.Pages(memvar).SetFocus
memvar = "Forms!Form1.TabCtl0.Pages('page2').SetFocus"
Eval (memvar)
Which is closest to your idea?
 
You solved it I'm sure. This is excellent advise. I should have sent back:
Forms![Main Tabs]![AR Customer Listing].SetFocus

The code you provided me will work I'm sure. Here goes!

Thanks a million!

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top