Full Version: Unbound calculation
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Jack210
Hello...
I have managed to link my unbound list box to a query, that calculates the average time a particular process takes. (Users only view this data)
I tried linking it to a combo box, but you have to click on the drop down to see the calculation, and a text box has no row source..also is it possible to format the value in the list box, for example if its greater the 30 mins then the font will be red..I was unable to get conditional formatting to work on a list box..

thanks
Jack
Alan_G
So you're query only returns one result and you're wanting to show that result and not a list ?

You can do that by putting an unbound textbox on your form, and in the Control Source put

=DLookup("NameOfQueryField","NameOfYourSavedQuery")

Conditional Fromatting will then work fine on the textbox
Jack210
Hi Alan,
Thanks for your reply, I have tried this and get an error - #Error

=DLookUp("Time Taken","Qry_Updated Average 1"), this is what I have typed in the control..

I used this query to calculate the average of five numbers, from a larger query, and created my own field name
called Time Taken. (see attachment)...any ideas why its not working...

thanks

Paul
Alan_G
Hi Jack/Paul

As you're using spaces in your naming (never a good idea in Access!!), you'll need to change it to

=DLookUp("[Time Taken]","[Qry_Updated Average 1]")

You may also want to check there's a result as well, and if not diplay 0 like this

CODE
=Nz(DLookUp("[Time Taken]","[Qry_Updated Average 1]"),0)
Jack210
Thanks very much.. it works !!!!..you saved me alot of time...

Jack/Paul
Alan_G
No problem....glad you got it working sad.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.