The M Code Behind the Power Query M function Access.Database

What is Access.Database?

Access.Database is a function in Power Query that is used to connect to and access data from Microsoft Access databases. It is part of the Microsoft Access Database Engine Redistributable, which is a set of components that enable communication with Microsoft Access databases. Access.Database can be used to connect to any Access database, whether it is stored locally or on a network server.

Understanding the M Code Behind Access.Database

The M code behind Access.Database is what enables Power Query to connect to and access data from Access databases. The code is written in the M language, which is the query language used by Power Query. The M code for Access.Database is as follows:

Access.Database(file as text, optional options as nullable record) as table

Let’s break down what this code means. The first parameter, “file as text”, specifies the path and file name of the Access database that you want to connect to. This can be either a local file path or a network path. The second parameter, “optional options as nullable record”, is an optional parameter that allows you to specify additional options for the connection. These options can include things like user credentials and query timeouts.

The output of the Access.Database function is a table that contains all of the data in the specified Access database. This table can then be used for further data transformation and analysis within Power Query.

Using Access.Database in Power Query

To use Access.Database in Power Query, you must first have the Microsoft Access Database Engine Redistributable installed on your computer. This can be downloaded from the Microsoft website. Once you have the engine installed, you can follow these steps to connect to an Access database using Access.Database:

1. Open Microsoft Excel and create a new workbook.

2. Click on the “Data” tab in the ribbon.

3. Click on the “Get Data” button and select “From Database” > “From Microsoft Access Database” from the dropdown menu.

4. In the “Access database” dialog box that appears, enter the path and file name of the Access database that you want to connect to. Click “OK”.

5. In the “Navigator” dialog box that appears, select the tables or queries that you want to import into Power Query. Click “Load” to import the data into Excel.

The Access.Database function in Power Query is a powerful tool for connecting to and accessing data from Microsoft Access databases. The M code behind the function enables Power Query to communicate with Access databases and retrieve data for further analysis. By understanding how Access.Database works and how to use it in Power Query, you can unlock the full potential of your data and gain valuable insights into your business.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us


    Your Name (required)


    Email (required)


    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)