Access Query: query thinks column name is a parameter. Help please

Anonymous
2015-12-03T18:50:56+00:00

Hi Access Gurus:

I am in need of some help.  I have a query created in QBE and have a the following column name:

CleanSize: IIf(UCase(Left([SortingGroupDesc],5))="CLEAN",IIf(Len(Trim(Right([SortingGroupDesc],3)))=2,"0" & Trim(Right([SortingGroupDesc],3)),Right([SortingGroupDesc],3)),IIf(UCase(Left([SortingGroupDesc],4))="CULL","Cull","Oth"))

That determines the "Clean Size" of the product being graded.

I have used the column name in other columns as part of an expression to determine the " Kg"of each clean size.  The expression looks like:

054: IIf([CleanSize]="054",[CleanKg],0)

This query has worked sine 2013 but today I needed to make a slight modification to it and no matter what I do when I run the query it prompts me (as if CleanSize) was a parameter and wants me to enter a value.  I have even deleted all columns from the query and re-added one field and ran the query and it still prompts for the "CleanSize" value.  I have closed and reopened the database and even restarted my computer.....all to no avail.

Any help is greatly appreciated.

Thanks.

Can someone please help me.....PLEASE.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Anonymous
    2015-12-03T19:19:31+00:00

    Try changing places of 'CleanSize' and '054.'

    EDIT - I generally find that Access processes a query from the bottom up (as viewed in SQL view) and your 054 will not see 'CleanSize' as it will not have been processed when Access tries to work on 054.

    0 comments No comments
  2. Duane Hookom 26,575 Reputation points Volunteer Moderator
    2015-12-03T23:24:15+00:00

    I always use the full expression rather than the alias column name to prevent errors like this.

    0 comments No comments
  3. ScottGem 68,780 Reputation points Volunteer Moderator
    2015-12-04T13:12:46+00:00

    Another solution to this issue is to use interim queries. I will often create one query that does my calculations created aliased columns. I will then use that query as the source of another query referencing those aliases.

    As Karl indicated, there is an order of processing for a query. So the reason you are getting prompted is that Access has not evaluated the aliased column at the time its trying to evaluate the calculation based on it. Hence it assumes you want to enter the value at run time.

    0 comments No comments