A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

dlookup error 2001



 
 
Thread Tools Display Modes
  #1  
Old August 8th, 2007, 03:22 PM posted to microsoft.public.access.reports
Matt
external usenet poster
 
Posts: 1,077
Default dlookup error 2001

Hello,

I have a query, LocationQuery2:

SELECT Count(GeneralTable.LocDesc) AS totalRatings, LocationQuery.LocDesc
FROM LocationQuery
GROUP BY LocationQuery.LocDesc;

Which takes LocDesc from the parameter query, LocationQuery:

SELECT GeneralTable.LocDesc, RatingsTable.Rating
FROM GeneralTable LEFT JOIN RatingsTable ON GeneralTable.Rating2 =
RatingsTable.Rating
WHERE (((GeneralTable.LocDesc) Like [Enter the Location Desc]) AND
((RatingsTable.Sorting)1));


I am trying to use a Dlookup to print the value from LocDesc in
LocationQuery2 into a text box in a report, but I keep getting "Run-time
error '2001': You cancelled the previous operation".

Essentially, when I run LocationQuery2, I enter in a parameter, "Brazil",
and one row is printed, "47" for totalRatings and "Brazil" for LocDesc. My
Dlookup in my report text box is: =DLookUp("[LocDesc]", "[LocationQuery2]").
Why can't I just get it to display "Brazil"?

Please Help!!


  #2  
Old August 8th, 2007, 05:44 PM posted to microsoft.public.access.reports
Ken Snell \(MVP\)
external usenet poster
 
Posts: 2,506
Default dlookup error 2001

You cannot use DLookup when the source query asks the user for a parameter
because DLookup will not cause the query to prompt for that value. You'll
need to change the query to read the desired value from a textbox on a form
that is open when the DLookup function is being run.

--

Ken Snell
MS ACCESS MVP


"Matt" wrote in message
...
Hello,

I have a query, LocationQuery2:

SELECT Count(GeneralTable.LocDesc) AS totalRatings, LocationQuery.LocDesc
FROM LocationQuery
GROUP BY LocationQuery.LocDesc;

Which takes LocDesc from the parameter query, LocationQuery:

SELECT GeneralTable.LocDesc, RatingsTable.Rating
FROM GeneralTable LEFT JOIN RatingsTable ON GeneralTable.Rating2 =
RatingsTable.Rating
WHERE (((GeneralTable.LocDesc) Like [Enter the Location Desc]) AND
((RatingsTable.Sorting)1));


I am trying to use a Dlookup to print the value from LocDesc in
LocationQuery2 into a text box in a report, but I keep getting "Run-time
error '2001': You cancelled the previous operation".

Essentially, when I run LocationQuery2, I enter in a parameter, "Brazil",
and one row is printed, "47" for totalRatings and "Brazil" for LocDesc.
My
Dlookup in my report text box is: =DLookUp("[LocDesc]",
"[LocationQuery2]").
Why can't I just get it to display "Brazil"?

Please Help!!




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.