Tutorial Microsoft Access VBA – Open File Dialog

Welcome to my website and today we are going to learn about Microsoft Access VBA. I am going to show you how to use the FileDialog property to get the selected file name in MS Access 2016. This method should works on previous MS Office version as well. 

Before we go through, here is the program looks like:

So basically, this VBA will open the file dialog and then get the selected file name and then display the file name and path in the Access Form. 

We are going to use one Button and one Label. Now let’s design the Form.

  1. Create a new Form in Microsoft Access
  2. Switch to Design mode
  3. Add one Button (Open File button) and one Label to the form

Let’s Coding

To enter the coding window, you can do the following:

  1. Right-click the Open File button
  2. Click Build Event
  3. Choose Code Builder from the list

Then the Code Builder window will open up. You will need to add the Microsoft Office 16.0 Object Library. To do this, go to Tools | References and then enable the Office 16.0 Object Library from the list and click OK. 

Now here is my code block in the Open File button:

Thank you.

 

 

Admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.