Converting A Excel Spreadsheet To Access Database

While I was scouring the Upwork gigs, one caught my eye, they left an Excel spreadsheet example and so I decide it was good enough to try and recreate it in Access database format.

I just couldn’t pass up the challenge on this one. So I figured I wanted to share the journey with you all.

First I want to find the sheet that has the source data for various worksheets in the workbook:

Here’s how I find it:

I highlighted all the sheet tabs yellow.

I found that 1 sheet has all the data for the pivot tables. This is the sheet, so I am going to create a table in Access based on this sheet:

You can create your own data table, but the easiest way to generate a table with the data, is just to import it:

After you import the Excel sheet with the data, just edit the fields. Also you need to change the name of the table (which will be imported as per the name of the worksheet)

I will change the name of the table to “tblTimeMaster” and leave the field names the same.

Now I’m going to construct a query based on the worksheet called “Hydr.VMOD” which is a pivot table.

The pivot table shows me all the fields I need for my query:

You may be asking, “why that sheet”? It was just an arbitrary sheet, and they look about the same. So if 1 works correctly then they all should work correctly. (If not, I’ll deal with it later 🙂 )

I need to find out what the pivot table is being filtered by, so I do this:

It’s being filtered by “Hydraulics” and “VMOD”, so my query is going to look like this:

Now since a pivot table in access is called a crosstab query, here is the way my crosstab query looks:

Now format the hours column to have no decimal places:

I had to add the jobcode_2 field, but here is how the result looks so far:

That looks pretty similar to the original spreadsheet, but not be can be creative and add new queries and buttons and reports and such.

Questions so far?

Read more here!






By the way, if you got or are getting value from the VBA information, please give me a tip, thanks!


These posts may help answer your question too...

How To Parse A Flat File In Excel VBA

In another post I demonstrated how to access a file on your computer using the MS Office Library. Here it is if you don’t know what I’m talking about. In this post, I am going to show you how to access the file and load it into your spreadsheet. I will do the same thing […]

How to pick a file to load In VBA

Picking a file to load in your Microsoft App is a very important skill to know. In this blog post you will see how to do it. First you need to set a reference to the MS office object library From VBE editor –> select Tools > MS office object library (click check mark) Sub […]

How can I interact with other Office applications (Excel) using VBA in Access?

Need to write your Access data or query to an Excel file? Here is the how to do it: Most people are familiar with Excel and know how to use it well (enough), and when you start talking about Access, they get scared off, and don’t know what to do anymore. Well, here you are […]

How To Create A Parameter Query In Access

A parameter query changes your ordinary static access query to be more dynamic and interactive. It will ask you a question about what you want to search for, allowing you to do a search query multiple times instead of just once. You can do your parameter query straight from the QBE (Query By Example) Editor, […]

Previous Post

Watch How To Run VBA Code In Access

Next Post

How To Search For A Folder In VBA