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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|