UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Dlookup From Count Query = #error, Access 2016    
 
   
brastedhouse
post Sep 28 2019, 11:04 AM
Post#1



Posts: 130
Joined: 16-March 15
From: Chautauqua, NY


Good morning, I have a REPORT that is bound to a query. That all works. But I need to include some information that I cannot get out of the query and the information is in tables I cannot join. The non-query information is in 5 text boxes. I have a query setup for each one. Each query counts the records of a field for a specific date range that I gather from dates entered in text boxes in an unbound form. I get an #Error in each of the report's text boxes. I have checked and there is data in the fields/tables and the querys return proper data.

So I am trying to use DLookup to get that information. Here is an example of a DLookup I am trying to use. They all give me an #Error:

i.e
=DLookup("[drillID]","[qryDrillCount]")

Here is the SQL for this query.
CODE
SELECT Count(tblDrill.drillID) AS CountOfdrillID, Month([drillDate]) AS drillMonth, Year([drillDate]) AS drillYear
FROM tblDrill
GROUP BY Month([drillDate]), Year([drillDate]);


I would appreciate any help on this.

Best, Scott
Go to the top of the page
 
RJD
post Sep 28 2019, 11:22 AM
Post#2


UtterAccess VIP
Posts: 10,136
Joined: 25-October 10
From: Gulf South USA


Hi Scott: I have read through your post several times, and I think we need more information. Perhaps you could post the db (or a cut-down version) for us to study. Usually, if we can see the db we can find the issue and give you a solution pretty fast. I think you know the drill on attachments, relevant objects, non-sensitive data, zipped.

In the meantime, if the query you posted is qryDrillCount, then DrillID from the DLookup is not a field in that query.

HTH
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
projecttoday
post Sep 28 2019, 12:26 PM
Post#3


UtterAccess VIP
Posts: 11,208
Joined: 10-February 04
From: South Charleston, WV


QUOTE
The non-query information is in 5 text boxes. I have a query setup for each one.


?

You might want to use Dcount instead of Dlookup.

--------------------
Robert Crouser
Go to the top of the page
 
brastedhouse
post Sep 28 2019, 10:44 PM
Post#4



Posts: 130
Joined: 16-March 15
From: Chautauqua, NY


Well I guess I need to learn about domain functions. I have used DLookup a few times, but I did not know about DCount. It worked perfectly. Once again I have to thank all of you here for your help and generous gift of time and talent.
Go to the top of the page
 
projecttoday
post Sep 29 2019, 03:30 AM
Post#5


UtterAccess VIP
Posts: 11,208
Joined: 10-February 04
From: South Charleston, WV


You're welcome and I'm glad that Dcount works for you. But I'm still wondering how a textbox with non-query information can have a query set up for it.

--------------------
Robert Crouser
Go to the top of the page
 
brastedhouse
post Oct 2 2019, 02:02 PM
Post#6



Posts: 130
Joined: 16-March 15
From: Chautauqua, NY


Here is an example of a dcount text box that is working perfectly. callMutualAidID is the primary key to that table and qryMutualAidCount is the query from the Mutual aid table that has the total row exposed and a count function in that field. Does that explain it? Sorry to be so vague but I am still working on my knowledge base of domain functions.

=DCount("[callMutualAidID]","[qryMutualAidCount]","[callMutualAidTypeFK] = 3")

Best Scott
Go to the top of the page
 
projecttoday
post Oct 2 2019, 02:29 PM
Post#7


UtterAccess VIP
Posts: 11,208
Joined: 10-February 04
From: South Charleston, WV


Okay. Good luck with your project.

--------------------
Robert Crouser
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    21st November 2019 - 07:20 PM