Query vs Dlookup

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Good day

I want to populate a textbox or combox which pulls data from my tables and calculates how much money I should have saved from a specific day. In order to do this it must a few variables, something easily done with the query design tool in Access 2007:

<code>
SELECT (Date()-[Start])*[$perDay] AS BTD, [Amount]/([end]-[start]) AS [$perDay], BAccounts.Amount, BAccounts.Open, BVendors.Vendor
FROM BVendors INNER JOIN BAccounts ON BVendors.ID = BAccounts.BVendor
WHERE (((BAccounts.Amount)>0) AND ((BAccounts.Open)=True));
</code>

My question is two part 1) how do I get the query field BTD to appear in a textbox (I tried to put the line below as the control source for the text box but it didn't work)

<code>
=[BTD Dollars]![BTD]
</code>

2) Is it more efficent to use Dlookup in a textbox instead of this query?

Thank you

Kavy
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
If the Query is used as Record Source to the Form, where the text box is, then you can use BTD directly on the Control Source property of the Text Box or use the expression as you have mentioned <code>=[BTD Dollars]![BTD]</code>. Otherwise you must use =Dlookup("BTD","QueryName") to bring the value into the Text Box.
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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