access vba - Is it possible to place a sub or function on one line in vba? -


i trying place sub on 1 line in access vba. there setting or special syntax can used accomplish this?

    private sub cmd_print() docmd.printout end sub 'creates error 

vs

    private sub cmd_print()      docmd.printout      end sub 

technically, yes, using instructions separator - colon : token:

private sub printcommand() : docmd.printout : end sub 

i strongly advise against though, obvious maintainability , readability reasons.

this particular layout used add-ins such vbwatchdog, generated code. because of how challenges expected structure of module, known cause problems add-ins process code, such rubberduck (which i'm heavily involved with) - that's because member attributes stored (you need export module see them, vbe doesn't display module , member attributes), rather counter-intuitively, outside procedure scope:

private sub printcommand() : docmd.printout : end sub attribute printcommand.vb_description = "this procedure xyz" 

the "normal" layout looks this, , doesn't cause issues:

private sub printcommand() attribute printcommand.vb_description = "this procedure xyz"     docmd.printout end sub 

it's easier read, too.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -