Reference Form Value in Query Function

toilettenseife

New Member
Joined
Oct 2, 2015
Messages
13
Good Afternoon,

I am trying to use the following formula to populate a field in a query:

CHRT_HLPR: IIf(X<=12 And X>=Y,X-(Y-1),X+(12-(Y-1)))

Y is a field in a table and X is a user inputted value from a form.

I tried to use [Forms]![Form_Name]![Text_Box_Name]. However, Access says the function is too complex.

Any ideas?

Thanks! :)
Tim
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I don't believe you can use values entered into an Unbound Form in a Calculated Field in a Query (you can use it in the Criteria row, but not in a Calculated Field (Expression).
If you want to include it in a calculation, store it in a field in a table somewhere.
 
Upvote 0
What exactly is it that you are trying to do/accomplish (what's the bigger picture here)?
 
Upvote 0
I think you could get the Y value using DLookup() -- if you have enough criteria to complete the DLookup function with arguments that cause it to return a single value as the result. The X part might work using a [FORMS]![MYFORM]![MYTEXTBOX] syntax.

It's a little ugly but maybe just possible.
 
Upvote 0

Forum statistics

Threads
1,221,783
Messages
6,161,938
Members
451,730
Latest member
BudgetGirl

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