2

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?

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!

1
  • Does the shell know about that program that edits this bar-code label file? In other words, does that program run when you double-click an lbl file in an Explorer window? Commented Jul 20, 2011 at 19:40

1 Answer 1

2

You have multiple alternatives in Access:

  1. Shell() (see the Help file)

  2. Application.FollowHyperlink (see the Help file)

  3. 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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, I take the ShellExecute().
Is that possible to pass some value to the program that I launched?
If you have to pass an argument, you'll have to use Shell() (or ShellWait(), which is available on the same site as ShellExecute() is from).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.