How to call a form name from a lookup table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jtgarrison
    New Member
    • Jan 2010
    • 18

    How to call a form name from a lookup table

    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.
    Code:
    Dim strFormName as String
    
    strFormName=dlookup("FormName","tblCurrentValues")
    
    if CurentProject.AllForms(strFormName).IsLoaded Then
        Forms!strFormName.Requery
    ...
    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.
    Last edited by NeoPa; Jul 1 '10, 03:54 PM. Reason: Please use the [CODE] tags provided.
  • gershwyn
    New Member
    • Feb 2010
    • 122

    #2
    Try referring to the form with this notation instead:

    Code:
    Forms(strFormName).Requery

    Comment

    • jtgarrison
      New Member
      • Jan 2010
      • 18

      #3
      Thanks!

      Something so easy cost me a couple of hours searching...

      Comment

      Working...