I thought of that but didnt' think it would work. Guess I should have tried
it first! Thanks
"Marshall Barton" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Keith G Hicks wrote:
>
> >I have a form with 20 checkboxes.
> >Each checkbox is associated with a report.
> >The TAG property for each checkbox is the name of a function that calls
the
> >report to be run.
> >The user is able to check off any number of reports.
> >When he hits the "Run Reports" button, the code loops thorugh all the
> >controls on the form, checks to see if the checkbox is checked and then
> >calls the function to run the report. The report calling code is
actually
> >located in a function in another module. Each report has it's own
function
> >that runs it. This is done because these reports can be called from many
> >different places and have quite a bit of code that runs prior to the
running
> >of each specific report.
> >Here's the problem. How do you call a function in the following manner?
> >
> > Dim ctl As Control
> > Dim i As Integer
> >
> > For i = 0 To (Me.Count - 1)
> > Set ctl = Me(i)
> > If Me(i).ControlType = acCheckBox Then
> > If Me(i) = True Then
> > 'This doesn't work: Call ctl.Tag & "()" ' where
> >ctl.Tag = MyFunction
> > 'This doesn't work either: Application.Run ctl.Tag &
> >"()"
> > End If
> > End If
> > End If
> > Next i
>
> As long as the things you want to call are a Public Function
> in a standard module, you can use the Eval function:
>
> xx = Eval(ctl.Tag & "()")
> --
> Marsh
> MVP [MS Access]