Correct syntax for Dlookup function within a report

  • Thread starter graeme34 via AccessMonster.com
  • Start date
G

graeme34 via AccessMonster.com

Hi I have an Invoice report with a child report that contains the Invoice
details. Within the invoice details is a control called VATRate. I have
managed to get this rate into the report footer where I need it for the
invoice summary. To do this I set the control source of the txtVATRate
(textbox control in the report footer) to =subrepInvLine.Report![VATRate].
Now I am trying to use the Dlookup function to find the VATValue from tblVAT.
I have tried numerous different statements but none seem to work.
Here is what I have been trying :
=DLookUp("VATValue","tblVAT","VATRate = " & subrepInvLine.Report![VATRate])

I have experimented wit hother criteria such as = & Reports!repInvoice!
txtVATRate

Could anybody help me out please???
Thank you!
 
W

Wayne Morgan

Where are you trying to use the equation you have (main report or subreport,
which section of the report)?
 
G

graeme34 via AccessMonster.com

Hi Wayne

I am trying to use the equation in the main report footer section. I gave up
eventually and altered my control source query of the main report to contain
both VATRate and VATValue.....although the query is now a bit lenghty.....but
at least it works....but for future reference if you know the correct Dlookup
equation I would be grateful.


Wayne said:
Where are you trying to use the equation you have (main report or subreport,
which section of the report)?
Hi I have an Invoice report with a child report that contains the Invoice
details. Within the invoice details is a control called VATRate. I have
[quoted text clipped - 13 lines]
Could anybody help me out please???
Thank you!
 
W

Wayne Morgan

The part after the & should be the same as the Control Source of the textbox
that displays the rate in the report footer, but without the equal sign
(which is what it appears you have, check for typos). I suspect the problem
may be that you need some brackets.

=DLookUp("VATValue","tblVAT","VATRate = " &
[subrepInvLine].[Report]![VATRate])

You may also be able to refer to txtVATRate instead.

=DLookUp("VATValue","tblVAT","VATRate = " & [txtVATRate])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top