Reference

  • Thread starter Thread starter dhauck
  • Start date Start date
D

dhauck

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...
 
dhauck said:
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...

No but Application.Run is...
 
dhauck said:
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
 
Thank you both very much!!!

Marshall said:
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
 
Back
Top