I'm trying to launch another program install in my system from my Access application. Or to open another file from Access, how can I do it?
开发者_Python百科EX: There's a file barcode_12mm.lbl
, I want to use VBA code to launch it in one program that edits this bar-code label file.
Thanks!
You have multiple alternatives in Access:
Shell() (see the Help file)
Application.FollowHyperlink (see the Help file)
ShellExecute() -- access.mvps.org/access/api/api0018.htm
The first requires you to know the path of the executable you are calling and is generally kind of fussy about getting the arguments properly formatted (you'll need double quotes for arguments with spaces in them, for instance).
The last two are for registered applications, such that if the file extension has an association defined, it will open the application associated with it. FollowHyperlink is easier, but ShellExecute provides more options.
ASIDE:
Note that many people think that using barcodes in Access requires an outside program or an ActiveX control. Barcodes are just fonts, so if you understand the format of the barcode encoding, it's really simple to just create your own barcodes within Access and not worry about any outside dependencies. Tony Toews has an article rounding up lots of information on the subject.
精彩评论