Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reference

0 views
Skip to first unread message

dhauck

unread,
Nov 17, 2007, 1:23:33 PM11/17/07
to
I'd like to indirectly reference a function...

if docmd.runcode functionVariable was allowed, I would be set....


Public Function Do_This(My_Thing As String, My_Type As String)
Select Case UCase(My_Type)

Case "FORM"
DoCmd.OpenForm My_Thing, acNormal, , , acFormEdit, acWindowNormal
...

Case "REPORT"
DoCmd.OpenReport My_Thing, acViewPreview


Case "CODE"
docmd.runcode My_Thing
..


Here is the rub. Docmd.runcode is not allowed...

Stuart McCall

unread,
Nov 17, 2007, 2:21:07 PM11/17/07
to
"dhauck" <u39163@uwe> wrote in message news:7b5c12928202d@uwe...

No but Application.Run is...

Marshall Barton

unread,
Nov 17, 2007, 2:31:17 PM11/17/07
to
dhauck wrote:

>I'd like to indirectly reference a function...
>
>if docmd.runcode functionVariable was allowed, I would be set....
>
>
>Public Function Do_This(My_Thing As String, My_Type As String)
> Select Case UCase(My_Type)
>
> Case "FORM"
> DoCmd.OpenForm My_Thing, acNormal, , , acFormEdit, acWindowNormal
> ...
>
> Case "REPORT"
> DoCmd.OpenReport My_Thing, acViewPreview
>
>
> Case "CODE"
> docmd.runcode My_Thing
>..


RunCode is a macro action so it is inappropriate in a VBA
procedure.

Help on the Run method is pretty complicated, but I think
you can get away with using:

Application.Run My_Thing

--
Marsh
MVP [MS Access]

dhauck

unread,
Nov 17, 2007, 3:24:32 PM11/17/07
to
Thank you both very much!!!

Marshall Barton wrote:
>>I'd like to indirectly reference a function...
>>

>[quoted text clipped - 14 lines]


>> docmd.runcode My_Thing
>>..
>
>RunCode is a macro action so it is inappropriate in a VBA
>procedure.
>
>Help on the Run method is pretty complicated, but I think
>you can get away with using:
>
> Application.Run My_Thing
>

--
Microsoft Access and Office Integration Experts
www.tabengineering.com
in...@abetterdatabase.com

0 new messages