In Access, is there a command to go to a control in design view from a command button?

dailymeat
dailymeat used Ask the Experts™
on
In Access, is there a command to go to a control in design view from a command button?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
sorry, but none. You can put the form in design view from a command button click with

docmd.openform me.name, acdesign
Distinguished Expert 2017

Commented:
What are you trying to do?

Author

Commented:
Want to open form in design view, go to a command button,  property event
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Distinguished Expert 2017

Commented:
OK, we got that much.  What do you want to do at that point?  Why do you have to put focus on the control?  Once the form is open in design view, you should be able to reference any control directly.   Keep in mind that Access is a Rapid Application Development tool intended for use in creating data-centric applications.  It isn't a graphic design tool so there is a limit to what you can actually do programmatically in design view.

Are you making a tool for yourself because this is not something you would ever do in an application you built for others to use.
Top Expert 2016

Commented:
my post at #a42041204  already answered your question.
MIS Liason
Most Valuable Expert 2012
Commented:
If I am understanding your request here correctly, ...You can try code like this perhaps:
(It worked for me, ...again, ...If I am understanding your request here correctly)

Private Sub Command13_Click()
    DoCmd.OpenForm "YourForm", acDesign
    Forms![YourForm]![CustName].InSelection = True
End Sub

Sample db attached

Not sure why you would need to do this...?
Also note that this will NOT work in a Runtime

JeffCoachman
Database22.accdb

Author

Commented:
It worked!, thank you
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Thanks, ...it took me a while to get the syntax just right.

Just note the cautions we all mentioned...

JeffCoachman
Top Expert 2016

Commented:
@jeff
that is nice. learned something new today ;-)
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Cap, ...Yeah, ...
For some reason, years ago, I remember a question on this, ...I think Scott posted the syntax...
;-)
I was not even certain the syntax still worked...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial