473,326 Members | 2,104 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,326 software developers and data experts.

DLookup a field based on a parameter

beacon
579 512MB
[Access 2003]

I have a report that is pulling data from a query. The query gets sent a parameter from a form. The information on the form is correct, but my summary section is incorrect.

The reason the summary is incorrect is because of the expression used to summarize. I'm using DLookup to find totals in a separate query.

Here's an example of my DLookup now:
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("CountOfStartingLocation","qryDestinationTotal","StartingLocation='Admissions'")
  2.  
This is great if I don't search by program, but ultimately that's what I want to do. The program is the parameter that's passed to the query initially. In order for me to pull the program parameter from this alternate totals query, do I need to add on to my DLookup?

I've added Program to the list of fields in the query and it works if I run the query...now I just need to get the summary fields to coincide.

Thanks for the help,
beacon
Dec 15 '08 #1
4 4185
beacon
579 512MB
I've attached a zip of the mdb. There are a couple of reports that have ByProgram in the title. These are the ones that need the parameter that's passed in to manipulate the summary fields at the end of the report.

Any help is greatly appreciated.

- beacon
Attached Files
File Type: zip Transport Service Tracking DB.zip (1.02 MB, 126 views)
Dec 15 '08 #2
csolomon
166 100+
Hi Beacon,
I do not think you can pass a parameter to a DLOOKUP...
Dec 15 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
csolomon's reply is correct - there is no way to supply a query parameter value as an argument to DLookup (or indeed to any of the other domain aggregate functions built in to Access - DSum, DCount and so on).

The simplest solution is to save a version of the query concerned without the reference to the form control you are filtering on, and use that with the Dlookup instead.

-Stewart
Dec 16 '08 #4
beacon
579 512MB
Okay...I gave up on DLookup and actually had some success with an alternate method on one report, but it's giving me trouble on another. It does the calculation after the parameter is accepted by the report, so I thought it would be okay to still include it within this thread.

Anyway, I have set a grouping level for a field on a query called [EndingLocation]. [EndingLocation] has string values like "Admissions", "Dental", and "Recreation." I entered the expression below, but I'm not returning any results, even though I know I have one entry for "Admissions."

Expand|Select|Wrap|Line Numbers
  1. 'Find the group labeled "Admissions" and total the number of records
  2. 'If the "Admissions" group doesn't exist, put nothing
  3.  
  4. =iif([EndingLocation]="Admissions", Sum([CountOfEndingLocation]), "")
  5.  
This isn't working for me for some reason although it worked on a similar report that was grouped by a formatted text box with a different name.

Any ideas?
Dec 16 '08 #5

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

Similar topics

2
by: Sue | last post by:
I sent an e-mail below and got a responese but i still have the #error message in the subject below: Can someone help me: questions and replies are separted by ----- -------My Questions: I have...
6
by: LSemos | last post by:
I am trying to lookup phone numbers in a separate table based on the name in the current Tab control tblContacts has the fields: Name, Phone, Fax, and Email In my Form's Tab control, I have...
4
by: thx606 | last post by:
Hello, I'm having problems figuring this one out. I have 2 combo boxes. The first one the user selects a professor then the second one they select a course and that works fine. Here is my...
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...
1
by: mstery | last post by:
I have a report generated via an ID selection made in a dropdown on a form. The report filters by an on click event in a preview report button on the form. Everything in the report, including...
8
by: Christine Henderson | last post by:
I have a problem using the above function in the following simplified circumstance: In the lookup table called "Klms Travelled" I have 3 fields, eg: Receiver Name Receiver Suburb ...
3
by: mmorgan1240 | last post by:
I have a form that I am trying to update. I would like to have a field populated by another table (State_laws) based on the value of another field on the form. I have a field called "state". When...
1
by: aharding | last post by:
Hello! I am using Access 2003 I have been playing with DLookup all morning and have not been successful yet. I have never used this function...and have some limited experience with code. I...
5
by: hrreece | last post by:
I have a form, Master List Temp, in Access 2003 that uses the Dlookup command to pull values from another table, Address Master. The user types in a person's home phone number in the HomePhone field...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.