MS Access help
Author
Discussion

Jonboy_t

Original Poster:

5,038 posts

214 months

Thursday 28th June 2018
quotequote all
HELLLLLP! Bit of back story - 2 people at work made redundant and left on the spot two weeks ago, one of which wrote a DB that we completely and utterly rely on and the team have done for over 10 years. I've very little experience of Access, but more than any of the other 3 that are left in the team so said I'd look at it. I.T don't want to know as 'we didn't write it, you're on your own with that one' (actual words, the little prick!). Looking at it, there are over 200 queries of all shapes and sizes, none of which have any form of order and they are named, wait for it.... 'query 1', 'query 2', 'query 3'. I st you not. 200 of the bds.

Anyway...

I've spent 2 weeks trying to add some semblance of normality to it and have deciphered and renamed most of the queries and Macro's (76 of them bad boys too!), but now it's come to the point that I need to add an extra into one query - I cannot for the life of me figure this bit out.

An existing 'make table' query produces a sort of summary sheet that's exported to a folder we all have access to. We need to add another column in it that sums up the total of a column in another table. Below is a picture of what I'm trying at the moment, which is essentially typing 'sum' and then the table name and column name next to it. There is a new field in the output table of this query (called 'Clearance Value'), I've used the 'Builder' to do the sum, I've used the sum formula in the 'criteria' field, I've Googled a gazillion different things to try and get to something and I've asked I.T for help (see previous comment!).



Is there any way of actually getting the sum of another table into a make table query!?!?! I'm going off my head trying to do this and am doing little more than pissing in the wind, so any advice at all would be magic.

kennydies

201 posts

149 months

Thursday 28th June 2018
quotequote all
I can't see the name of the table in the query you are trying to use in your make table query, it should be the same.


What error message are you getting?

Jonboy_t

Original Poster:

5,038 posts

214 months

Thursday 28th June 2018
quotequote all
kennydies said:
I can't see the name of the table in the query you are trying to use in your make table query, it should be the same.


What error message are you getting?
Sorry, I inadvertently cut that off. The name of the table that has the data in it is 'LM_StoreClearance' so matches the name in the 'table' field.

The error messages are either "Syntax error in query expression 'LM_StoreClearance.[Sum(LM_StoreClearance]]![[Value@Cost])]". or "Your query does not include the specified expression 'Site' as part of an aggregate function."

kennydies

201 posts

149 months

Thursday 28th June 2018
quotequote all
Hi there.

If this is a make table query try these steps to build the query correctly:

As you already have a make table query
Remove the criteria from the criteria pane (bottom of the screen) so you have a blank canvas.
Double click the field you are adding the sum too and this will add it to the criteria pane
On the design tool bar click on the totals button and this till add a total criteria and will probably default to "Group By"
Change the Group By to Sum

Should look something like this

Jonboy_t

Original Poster:

5,038 posts

214 months

Thursday 28th June 2018
quotequote all
kennydies said:
Hi there.

If this is a make table query try these steps to build the query correctly:

As you already have a make table query
Remove the criteria from the criteria pane (bottom of the screen) so you have a blank canvas.
Double click the field you are adding the sum too and this will add it to the criteria pane
On the design tool bar click on the totals button and this till add a total criteria and will probably default to "Group By"
Change the Group By to Sum

Should look something like this
I could flippin kiss you! Thank you so much, that worked a treat beer

kennydies

201 posts

149 months

Thursday 28th June 2018
quotequote all
I will settle for a Jameson on ice :-)

Jonboy_t

Original Poster:

5,038 posts

214 months

Thursday 28th June 2018
quotequote all
kennydies said:
I will settle for a Jameson on ice :-)
Done!