473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Can i use the result of a Dlookup expression for a calculation

Hi,
i have a report that imports a number with the dlookup function from one table, and i want to use that number in a calculation, is that possible?
Jun 15 '10 #1
2 1510
Stewart Ross
2,545 Expert Mod 2GB
Hi annakali. You will need to repeat your DLookup for your calculation, as you will likely find that you cannot use the value previously looked up and placed (I would guess) on an unbound textbox control on your report.

An approach which provides better flexibility is to base your report on a query which includes joins to the table or query you are looking up, or, if this is not possible, to include the DLookup in that recordsource query instead. You will then be able to refer to the value by including a control on your report bound to that field.

-Stewart
Jun 15 '10 #2
Hi Stewart,
thank u for ur advise, however my exact problem is the following.

I create a report, grouped by the customer code to display for every customer , his opening balance which i retrieve with the dlookup function from my table called accounts and i placed it in the customer code header, and in the details section i have the fields : date, transaction, debit, credit, and balance. I create the balance field through a text box with a running sum, and assign the control source property as follow
=[cramount]-[drAMOUNT]+DLookUp("[opening balance]";"accounts";"[Accountnumber] = " & "'" & Reports!customers_statements!customercode & "'")

Imagine something like ur bank statement. The problem now is that, in the first row of the data i get the correct balance but in the rest ones is wrong because is adding again the opening balance, so i thing i need to enter a code dealing with a counter, and when my counter is >1 (after the first row) then no to add the opening balance. Unfortunatelly i dont know how to do it.
I would be thankful, if u can help me.
Jun 16 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Knud Rogilds | last post by:
I have tried everything, what am I doing wrong? I have a data entry form in datasheet view (for mass data entry). One of the fields are SalesID, and I would like to use DLookup to populate an...
1
by: tnt | last post by:
I have set up a table and a form initially when i use these without modifications the data transfers fine. However when i use the expression builder to create a calculation in one of the form...
7
by: Tony Williams | last post by:
Does DLookup work in an expression in a query? I have this expression -(DLookUp("","tblmaintabs","= ")) Which works fine as a calculated control on a form but when I try to use it in a query as an...
0
by: Tony Williams | last post by:
I have posted a number of posts in the Access newsgroups concerning my problem with DLookup. I have had a number of the experts with helpful suggestions but I still can't get it to work! This is...
2
by: Nicolas | last post by:
Why does for the same code I got different result the VB code gave me what I want why not the csharp? Thank you for your help... CSHARP CODE int sx, sy; double sdegrees; sdegrees = (90 -...
4
by: Rico | last post by:
Hi Folks! I have a strange thing happening; I have a field that Counts the number of records and another field that shows the number of clients (Count(RecordID)=3 and NoOfClients=2) When I do a...
3
by: DaveUssell | last post by:
Thank you for being here. I've bashed my head without help so far, but I'm rapidly running out of time and could use a hand. I don't think it should be too difficult for an experienced Access...
3
by: hrreece | last post by:
I am trying to use the Dlookup expression in a macro to pull the value from the "Price" field in the following query. The query works fine and the Dlookup function did as well until I added a new...
1
natalie99
by: natalie99 | last post by:
Hi everyone I am having a slight problem with an expression result. I am running a query which results in some fields yielding a (correct) null value. The expression is mathematical, how do I...
7
Breezwell
by: Breezwell | last post by:
This is probably a simple question for someone out there. I understand that the DLookup function takes has the following syntax: DLookup(expression,domain,) From what I have read, domain can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.