-1

I need to export an Access query into an Excel spreadsheet and add blank cells. My data from the Access query looks like this:

1018
522
347
449
271
221
7
6
238
90
185
34
117
144

But I will need it to look like this in Excel:

1018
522



347
449



271
221

And so on. I've done doCmd.TransferSpreadsheet but it doesn't allow for exporting ranges. Other examples I've seen that involve more VBA, don't go into formatting in that way. Any ideas where I should look? Thanks.

2

1 Answer 1

0

I don't have much time, so hope this makes sense:

Make a make-table-query, that takes your source query, adds autonumber, and a field called Place= autonumber * 10, and creates a table called tblNew.

1018 will have Place=1 * 10 = 10
522 will have Place= 2 * 10 = 20
347 will have Place=3 * 10 = 30
etc.

Make a select query, qryBlank, that makes a blank line for each record with Place=20,40,60 etc. in tblNew. Each blank line must have Place = 20 +1, 40+1, 60+1 etc.

Make a union query between tblNew and qryBlank.

Now you have one line between the pairs. You can just add more queries like qryBlank to make more lines.

Make a make-table query, that selects * from the union query, orders by the field Place, and creates a new table.

Link to the new table in Excel.

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

3 Comments

Interesting idea. I will try that tomorrow and let you know how it goes.
I couldn't use your method because exactly because I only have read permissions on the data, so make table won't work. But I took your idea in a different way. I created a separate query to make blank lines and unioned the two queries together multiple times. It's a horribly way to do it, I'm sure, but it gets me exactly what I needed. So thanks for the inspiration and I'm sure your way would help others so I marked it as answered.
Sweet. Work-arounds is what Access is all about.

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.