DLookUp Total Sale from Access Template

guest

Board Regular
Joined
Feb 21, 2002
Messages
91
Hi

I have the following in the control source of a text box in a custom form within the MS Access Purchasing Database Template
Code:
=DLookUp("[Total Sale]","[Forms]![Orders by Customer Subform]","[OrderID]='" & [Forms]![Orders by Customer Subform]![OrderID] & "'")

I want to lookup the total sale of an OrderID from the Orders by Customer subform.

Can anyone see anything blatantly wrong with this?

Thanks
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I take it this is on the main form?

If so I think your reference to the subform is wrong.

Have a look at the Access Help for subforms>referring to in expressions.

I think you need something like this:

[Forms]![Main Form]![Orders by Customer Subform].Form![OrderID]

Where Main Form is the form that the subform is on.
 
Upvote 0
Thanks for the assistance, I have amended the line to read:
Code:
=DLookUp("[Total Sale]","[Forms]![Orders]![Orders by Customer Subform].Form","[OrderID]='" & Forms!Orders![Orders by Customer Subform].Form!OrderID & "'")
But am receiving a #name error.
 
Upvote 0

Forum statistics

Threads
1,221,821
Messages
6,162,157
Members
451,750
Latest member
pnkundalia

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