By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,628 Members | 1,880 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,628 IT Pros & Developers. It's quick & easy.

How to call a form name from a lookup table

P: 18
I have a database front end that stores variables based on what the user is doing. What I want to do is requery a form, but the form is being looked up from the table.

Ex.
Expand|Select|Wrap|Line Numbers
  1. Dim strFormName as String
  2.  
  3. strFormName=dlookup("FormName","tblCurrentValues")
  4.  
  5. if CurentProject.AllForms(strFormName).IsLoaded Then
  6.     Forms!strFormName.Requery
  7. ...
When I run it, I get "...can't find the Form 'strFormName' referred to in a macro expression or Visual Basic Code.

Any ideas?

Thanks.
Jun 30 '10 #1

✓ answered by gershwyn

Try referring to the form with this notation instead:

Expand|Select|Wrap|Line Numbers
  1. Forms(strFormName).Requery

Share this Question
Share on Google+
2 Replies


100+
P: 122
Try referring to the form with this notation instead:

Expand|Select|Wrap|Line Numbers
  1. Forms(strFormName).Requery
Jun 30 '10 #2

P: 18
Something so easy cost me a couple of hours searching...
Jun 30 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.