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
Post a Comment