Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jan 2001
    Location
    Vermont
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Call a routine whose name is in a variable (Access 2000)

    I have a nice little system with a single screen on which users specify criteria for what records they want to see, and a number of forms on which they look at their data. A number of these forms can be open at the same time. When the user changes the criteria, I need to run around and call a routine in each of the open forms to update the display. What I'd like to do is run through each of the open forms and call a routine in that form. But that requires constructing the routine name dynamically, then calling it. I can't figure out how to do that. Something like:

    dim F as form
    dim strFormName as string

    for each F in forms
    strFormName=F.name
    call strFormName.NewCriteria
    next F

    Obviously "strFormName" in "strFormName.NewCriteria" is going to refer to a form named "strFormName", rather than the name that's IN strFormName, so this won't do what I want.

    Is there anything that will?

    Thanks
    Jordan

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Call a routine whose name is in a variable (Access 2000)

    You don't actually need the form name if you're looping through the forms collection ... at least, not unless you want to use it test for forms to exclude or some such. Try it this way instead. And don't forget to set F to nothing when you exit the routine to release the resources it used.


    dim F as form

    for each F in forms
    call F.NewCriteria
    next F
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •