Using a variable in a control reference

G

Guest

Hope I got that title right.

I use one form with command buttons to pass the name of a third form to be
used as the openargs of the second, intermediary form. If that does not make
sense -
I have a form name in openargs. I then use a variable STDOCNAME =
me.openargs to refer to that form name throughout code. When I finally open
that form, I want to turn on the navigation buttons. However, this does not
appear to work:

stDocName = Me.OpenArgs
DoCmd.OpenForm stDocName, acNormal, , sfilt
MsgBox ("Please use the navigation buttons, not the drop down boxes, to
move between records")
Forms!stDocName.NavigationButtons = True

What should this look like?
 
R

Rick Brandt

Biggles said:
Hope I got that title right.

I use one form with command buttons to pass the name of a third form
to be used as the openargs of the second, intermediary form. If that
does not make sense -
I have a form name in openargs. I then use a variable STDOCNAME =
me.openargs to refer to that form name throughout code. When I
finally open that form, I want to turn on the navigation buttons.
However, this does not appear to work:

stDocName = Me.OpenArgs
DoCmd.OpenForm stDocName, acNormal, , sfilt
MsgBox ("Please use the navigation buttons, not the drop down
boxes, to move between records")
Forms!stDocName.NavigationButtons = True

What should this look like?

Forms(stDocName).NavigationButtons = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top