Dirk Goldgar replied to QB
20-Nov-09 02:34 PM
Unfortunately, you have to change your basic concept, as the target of the
GoTo statement cannot be evaluated at run time. You could have a Select
Case statement:
Function DoMyWorkForMe(sDoWhat as string)
Select Case sDoWhat
Case "This"
' ... do "This" stuff ...
Case "That"
' ... do "That" stuff ...
Case "The Other"
' ... do "The Other" stuff ...
Case Else
MsgBox "What did you want to do?"
End Select
End Function
Or you could write a different public Function or Sub to perform each block
of work, pass the name of the desired procedure to function DoMyWorkForMe,
and use the Run method to call the procedure by name:
Function DoMyWorkForMe(sDoWhat as string)
Application.Run sDoWhat
End Function
--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html
(please reply to the newsgroup)