Using Calculate Field in Same Query

chethead

New Member
Joined
Jul 23, 2015
Messages
45
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I have a very limited knowledge of Access and am struggling through and enjoying creating my first database. When in query design view, I created a field by entering the following formula into the field region:

Lab$: [LabHours]*([CrewRate]+[OHRate])

So when I switch to datasheet view, I get a new column that executes exactly what I want it to do.

Question - can I in turn use Lab$ in the same query in which it was created? I am able to see it and use it when I create query 2 by using query 1 but I can't figure out a way to use it in the query 1.

Thank you,

Rob Schmidt
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Question - can I in turn use Lab$ in the same query in which it was created?
Yes. Just refer to it like this in your next calculation: [Lab$], i.e.
Code:
Raise$: [Lab$] * 1.1
 
Upvote 0
Thank you. I have tried that, as it makes logical sense but have run across multiple errors. This time I was told I had some aggregate something or other. Maybe it is just easier to have one query that does a slew of calculations and then do my secondary calculations in query 2 based off of query 1.

The theory and logic behind some of the decisions I need to make seems very complicated. Any advice on understanding best practices?
 
Upvote 0
This time I was told I had some aggregate something or other.
So, is this an Aggregate Query? If so, the rules may be a bit different. It probably depends on how it is all set-up.
When posting questions like this, it is often helpful to post the SQL code of your query so we can get a better idea of all that is happening (you can do this by switching the query to SQL View and and copying and pasting the code here).

Some advice is to not try to do too much within a single query (*especially if you are using the Query Builder to build it instead of writing the SQL code directly yourself). It can make it very complex and hard to understand, debug, and support. There is nothing wrong with using multiple queries for a task.

*I have this caveat, because if you are proficient at writing SQL code directly, you can often used nested queries to do in a single query that which might otherwise take multiple queries. However, this is definitely a more advanced thing (for those who are comfortable writing SQL code).
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top