473,503 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enter Parameter Value Error Message

5 New Member
Hello,

I recently started working with access for a school project in my Information Systems Management class. I'm a Finance major so it's not like I had to get this deep into this stuff, but I have a wondering mind. I put together my table and proceeded to creating my queries and they all work fine but one. I have read forum after forum trying to figure out the solution to my problem but no luck I could do without this query but after so much reading of all this code stuff I'm actually curious as to where the problem lies.

In the problematic query I want a field to perform a calculation that divides one of the columns in the problematic querry by a number in another querry, that just happens to be a one number query. I grouped my suppliers by supplierID and summed the amount of books I get from each giving me a UnitsInStock for each supplier. I would like to divide each supplier's amount of book by the total which is 371 but this number is the answer to one of my queries, inventory book total. SO I used the expression maker to create a field that divides SumOfUnitsInStock of each supplier, a field in the problematic query, by SumOfUnitsInStock a field in a query that adds up the UnitsInStock field in one of my tables. Everytime I run it, it asks me to Enter Parameter Value for Inventory Book Total!SumOfUnitsInStock. If I enter the 371, which is the of the corresponding query it works. How do I get it to stop asking so it just finds the value on its own. This is the SQL of the querry. I also used the documenter so I have a copy of that if it helpful. Any hep would be nice.

Expand|Select|Wrap|Line Numbers
  1. SELECT Suppliers.SupplierID, Suppliers.SupplierName, Count(Textbooks.SupplierID) AS CountOfSupplierID, Sum(Textbooks.UnitsInStock) AS SumOfUnitsInStock, [SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock] AS Expr1
  2. FROM Suppliers INNER JOIN Textbooks ON Suppliers.SupplierID = Textbooks.SupplierID
  3. GROUP BY Suppliers.SupplierID, Suppliers.SupplierName
  4. ORDER BY Suppliers.SupplierID;
Jul 14 '07 #1
13 4472
NeoPa
32,557 Recognized Expert Moderator MVP
You have no source defined (in the FROM clause) as [Inventory Book Total].
The SQL engine will look at that expression and will treat it as an enterable parameter. Essentially unrecognised.
If you want to include the data from a separate query, you must include it in the FROM clause (It's possible, though not advised, simply to use a DLookup() here). If I understand you correctly, this query always returns a single result. If so, try this :
Expand|Select|Wrap|Line Numbers
  1. SELECT Suppliers.SupplierID,
  2.        Suppliers.SupplierName,
  3.        Count(Textbooks.SupplierID) AS CountOfSupplierID,
  4.        Sum(Textbooks.UnitsInStock) AS SumOfUnitsInStock,
  5.        [SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock] AS Expr1
  6. FROM Suppliers INNER JOIN Textbooks
  7.   ON Suppliers.SupplierID = Textbooks.SupplierID,
  8.      [Inventory Book Total]
  9. GROUP BY Suppliers.SupplierID, Suppliers.SupplierName
  10. ORDER BY Suppliers.SupplierID;
Whether or not it makes any sense to divide one [SumOfUnitsInStock] value by another I'll leave up to you to sort out ;)
Jul 15 '07 #2
puppydogbuddy
1,923 Recognized Expert Top Contributor
Hello,

I recently started working with access for a school project in my Information Systems Management class. I'm a Finance major so it's not like I had to get this deep into this stuff, but I have a wondering mind. I put together my table and proceeded to creating my queries and they all work fine but one. I have read forum after forum trying to figure out the solution to my problem but no luck I could do without this query but after so much reading of all this code stuff I'm actually curious as to where the problem lies.

In the problematic query I want a field to perform a calculation that divides one of the columns in the problematic querry by a number in another querry, that just happens to be a one number query. I grouped my suppliers by supplierID and summed the amount of books I get from each giving me a UnitsInStock for each supplier. I would like to divide each supplier's amount of book by the total which is 371 but this number is the answer to one of my queries, inventory book total. SO I used the expression maker to create a field that divides SumOfUnitsInStock of each supplier, a field in the problematic query, by SumOfUnitsInStock a field in a query that adds up the UnitsInStock field in one of my tables. Everytime I run it, it asks me to Enter Parameter Value for Inventory Book Total!SumOfUnitsInStock. If I enter the 371, which is the of the corresponding query it works. How do I get it to stop asking so it just finds the value on its own. This is the SQL of the querry. I also used the documenter so I have a copy of that if it helpful. Any hep would be nice.

Expand|Select|Wrap|Line Numbers
  1. SELECT Suppliers.SupplierID, Suppliers.SupplierName, Count(Textbooks.SupplierID) AS CountOfSupplierID, Sum(Textbooks.UnitsInStock) AS SumOfUnitsInStock, [SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock] AS Expr1
  2. FROM Suppliers INNER JOIN Textbooks ON Suppliers.SupplierID = Textbooks.SupplierID
  3. GROUP BY Suppliers.SupplierID, Suppliers.SupplierName
  4. ORDER BY Suppliers.SupplierID;

I see 2 possible causes for parameter message. Try the remedy in #1 first. If that doesn't fix it, then try the remedy in #2:

1. [SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock] AS Expr1
You have [SumOfUnitsInStock] appearing twice in this expression. They apparently come from 2 different queries, one of which is identified as coming from [Inventory Book Total] and the other is not identified as to source. This is what Access calls "an ambiguous expression". If this is the problem, all you need to do is put the query name associated with the ambiguous field name like you did for the one coming from [Inventory Book Total].

2. Try declaring your Parameters on the Access Parameter List. To invoke this Parameter List, right mouse click on the top part of the query and choose Parameters. A parameter declaration form appears to let you list each parameter name and its type. Declaring Parameters in the list of parameters is sometimes needed in order for Access to know how to handle them.
Jul 15 '07 #3
puppydogbuddy
1,923 Recognized Expert Top Contributor
Sorry Adrian...did not know you were working on this one....but at least we were both thinking along the same lines.
Jul 15 '07 #4
cfrance1
5 New Member
I copied what you sent me and put it in once I saw it in design view, I realized that I had tried that already. And when try and run after adding the source, what you gave me, I get a message that says:

"You tried to execute a query that does not include the specified expression '[SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock]' as part of an aggregate function."

The query I am trying to run should give me a field with 5 different values corresponding to 5 different suppliers. What I did is one querry I summed up the total amount of books hence [Inventory Book Total]![SumOfUnitsInStock] in the denominator of the, problematic, equation. Then I ran another query that counts UnitsInStock by supplierID that way I know how how many books are from each supplier. Now within this same querry I want to create a field that puts the UnitsInStock, by supplier, over the entire stock 317 which is the annswer to the query [Inventory Book Total]![SumOfUnitsInStock]. I could just write 317 in the denominator of the equation therefore when it asks for the parameter value and I put 317 I get my percentages but if I change the level of units in stock in the table these ratios won't change accordingly.

I am sorry If I'm being a bit redudant here, just trying to be very detailed. Now what did you say Dlookup, I'm not familiar with too much stuff as you can tell.
What do you think is causing the error message above.

Thanks for all your help
Jul 15 '07 #5
cfrance1
5 New Member
I see 2 possible causes for parameter message. Try the remedy in #1 first. If that doesn't fix it, then try the remedy in #2:

1. [SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock] AS Expr1
You have [SumOfUnitsInStock] appearing twice in this expression. They apparently come from 2 different queries, one of which is identified as coming from [Inventory Book Total] and the other is not identified as to source. This is what Access calls "an ambiguous expression". If this is the problem, all you need to do is put the query name associated with the ambiguous field name like you did for the one coming from [Inventory Book Total].

2. Try declaring your Parameters on the Access Parameter List. To invoke this Parameter List, right mouse click on the top part of the query and choose Parameters. A parameter declaration form appears to let you list each parameter name and its type. Declaring Parameters in the list of parameters is sometimes needed in order for Access to know how to handle them.

I understand what you are trying to say in remedy one. THat my denominator has a source [Inventory Book Total] but not my numerator. Thats because the source of the [SumOfUnitsInStock] on the top part of the equation is the actual query I am trying to put the [SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock] AS Expr1 into. Can I use the open query as a source for an equation within the query?

ANd in remedy 2 I've found that box plenty of times but I'm such a newbie I have no idea what to do with that.
Jul 15 '07 #6
puppydogbuddy
1,923 Recognized Expert Top Contributor
I understand what you are trying to say in remedy one. THat my denominator has a source [Inventory Book Total] but not my numerator. Thats because the source of the [SumOfUnitsInStock] on the top part of the equation is the actual query I am trying to put the [SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock] AS Expr1 into. Can I use the open query as a source for an equation within the query?

ANd in remedy 2 I've found that box plenty of times but I'm such a newbie I have no idea what to do with that.
<<Can I use the open query as a source for an equation within the query?>>
As far as I know......No, but you can use a domain aggregate function, such as Dsum (see below).

Replace the denominator (Inventory Book Total]![SumOfUnitsInStock]) with the DSum function, short for Domain sum function that has this syntax where the domain is the total for all suppliers:

DSum("[UnitsInStock]", "[Inventory Book Total]”)

For your information, if you wanted to you could aggregate by supplier using the following syntax. This syntax assumes that SupplierID is numeric.

DSum("[UnitsInStock]", "[Inventory Book Total]”, "[SupplierID] = " & Suppliers.SupplierID)
Jul 15 '07 #7
cfrance1
5 New Member
<<Can I use the open query as a source for an equation within the query?>>
As far as I know......No, but you can use a domain aggregate function, such as Dsum (see below).

Replace the denominator (Inventory Book Total]![SumOfUnitsInStock]) with the DSum function, short for Domain sum function that has this syntax where the domain is the total for all suppliers:

DSum("[UnitsInStock]", "[Inventory Book Total]”)

For your information, if you wanted to you could aggregate by supplier using the following syntax. This syntax assumes that SupplierID is numeric.

DSum("[UnitsInStock]", "[Inventory Book Total]”, "[SupplierID] = " & Suppliers.SupplierID)

WHen I try DSum("[UnitsInStock]", "[Inventory Book Total]”) in the denominator of the expression I get this error message:

"You tried to execute a query that does not include the specified expression '[SumOfUnitsInStock]/DSum("[UnitsInStock]", "[Inventory Book Total]”) as part of an aggregate function."

I have tried a bunch of different things. But it always asks me the Inventory ook Total and when I run that querry it comes up wtih the 317 I want. Its almost like it dosen't fid that number when it looks for it. I know what I'm trying to do can not be too much for access. If I ran the analyze documenter thing and included the table and query that this expression is oming from would it be clearer to see the problem.

THanks
Jul 15 '07 #8
puppydogbuddy
1,923 Recognized Expert Top Contributor
WHen I try DSum("[UnitsInStock]", "[Inventory Book Total]”) in the denominator of the expression I get this error message:

"You tried to execute a query that does not include the specified expression '[SumOfUnitsInStock]/DSum("[UnitsInStock]", "[Inventory Book Total]”) as part of an aggregate function."

I have tried a bunch of different things. But it always asks me the Inventory ook Total and when I run that querry it comes up wtih the 317 I want. Its almost like it dosen't fid that number when it looks for it. I know what I'm trying to do can not be too much for access. If I ran the analyze documenter thing and included the table and query that this expression is oming from would it be clearer to see the problem.

THanks
In general, that error message means the Group by clause must contain the same columns from the table as specified in the Select Statement. .. so modify your group by as follows:

GROUP BY Suppliers.SupplierID, Suppliers.SupplierName, Suppliers.UnitsInStock
Jul 15 '07 #9
NeoPa
32,557 Recognized Expert Moderator MVP
Sorry Adrian...did not know you were working on this one....but at least we were both thinking along the same lines.
That's never a problem PDB ;)
I'm sure we'll crack it together.
Jul 15 '07 #10
NeoPa
32,557 Recognized Expert Moderator MVP
I copied what you sent me and put it in once I saw it in design view, I realized that I had tried that already. And when try and run after adding the source, what you gave me, I get a message that says:

"You tried to execute a query that does not include the specified expression '[SumOfUnitsInStock]/[Inventory Book Total]![SumOfUnitsInStock]' as part of an aggregate function."

The query I am trying to run should give me a field with 5 different values corresponding to 5 different suppliers. What I did is one querry I summed up the total amount of books hence [Inventory Book Total]![SumOfUnitsInStock] in the denominator of the, problematic, equation. Then I ran another query that counts UnitsInStock by supplierID that way I know how how many books are from each supplier. Now within this same querry I want to create a field that puts the UnitsInStock, by supplier, over the entire stock 317 which is the annswer to the query [Inventory Book Total]![SumOfUnitsInStock]. I could just write 317 in the denominator of the equation therefore when it asks for the parameter value and I put 317 I get my percentages but if I change the level of units in stock in the table these ratios won't change accordingly.

I am sorry If I'm being a bit redudant here, just trying to be very detailed. Now what did you say Dlookup, I'm not familiar with too much stuff as you can tell.
What do you think is causing the error message above.

Thanks for all your help
You got that error message because I forgot to include the extra item in the GROUP BY clause.
Expand|Select|Wrap|Line Numbers
  1. SELECT Suppliers.SupplierID,
  2.        Suppliers.SupplierName,
  3.        Count(Textbooks.SupplierID) AS CountOfSupplierID,
  4.        Sum(Textbooks.UnitsInStock) AS SumOfUnitsInStock,
  5.        [SumOfUnitsInStock]/[Inventory Book Total].[SumOfUnitsInStock] AS Expr1
  6. FROM Suppliers INNER JOIN Textbooks
  7.   ON Suppliers.SupplierID = Textbooks.SupplierID,
  8.      [Inventory Book Total]
  9. GROUP BY Suppliers.SupplierID,
  10.          Suppliers.SupplierName,
  11.          [Inventory Book Total].[SumOfUnitsInStock]
  12. ORDER BY Suppliers.SupplierID;
Jul 15 '07 #11
NeoPa
32,557 Recognized Expert Moderator MVP
While the SQL in the previous post should work for what you're trying to do, it is a pretty crappy way to get this to work (as you'll need multiple queries designed for the various categories). Try sharing the underlying table structures with us (Table MetaData) and what you REALLY want, and we'll see if we can't come up with a more appropriate solution for you.
Here is an example of how to post table MetaData :
Table Name=tblStudent
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. StudentID; AutoNumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. Mark; Numeric
  7. LastAttendance; Date/Time
Jul 15 '07 #12
cfrance1
5 New Member
You got that error message because I forgot to include the extra item in the GROUP BY clause.
Expand|Select|Wrap|Line Numbers
  1. SELECT Suppliers.SupplierID,
  2.        Suppliers.SupplierName,
  3.        Count(Textbooks.SupplierID) AS CountOfSupplierID,
  4.        Sum(Textbooks.UnitsInStock) AS SumOfUnitsInStock,
  5.        [SumOfUnitsInStock]/[Inventory Book Total].[SumOfUnitsInStock] AS Expr1
  6. FROM Suppliers INNER JOIN Textbooks
  7.   ON Suppliers.SupplierID = Textbooks.SupplierID,
  8.      [Inventory Book Total]
  9. GROUP BY Suppliers.SupplierID,
  10.          Suppliers.SupplierName,
  11.          [Inventory Book Total].[SumOfUnitsInStock]
  12. ORDER BY Suppliers.SupplierID;
Oh Now I see Why you are the Leader. THis worked out just like I wanted it. I'm more of a stock guy but this coding stuff is kind of addictive. Now that I have the answer I'm just gonna stare at this to see if I can figure out where the problem was. I also noticed that in my suppliers table, now, there is a plus sign next to the records and when open them I see each book that corresponds to that suplier. It's Proffesional looking I like it. Where did it come from, is it from this query I have been trying to make work and now that it works it travels up to the table. OR is it something you put in the code of the Querry.

While the SQL in the previous post should work for what you're trying to do, it is a pretty crappy way to get this to work (as you'll need multiple queries designed for the various categories).
Yeah I know it is probably not the neatest quickest way to do things, but up until now All I knew about access was stupid stuff like sort and other options you get from clicking around the options. But I see there is a whole world behind that. Thats all I needed for the project but might be back just out of curiosity, I bet you culd come up with some really cool things with all this coding stuff. Thanks for all your help
Jul 15 '07 #13
NeoPa
32,557 Recognized Expert Moderator MVP
Feel free to come back and ask more questions. You're a member after all ;)
BTW. All the Moderators are just Experts with extra responsibilities on here. Being a Moderator (or even Forum Leader), is not a reflection of how clever we are, or even how expert we are at Access. Most of us have gaps in our knowledge (I know I do), but the overlay of all of our skills should make a fairly decent cover for the subject.
Jul 16 '07 #14

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

Similar topics

3
5485
by: Phil IU Guy | last post by:
I am having 2 issues, both acting very randomly, and for the most part I dont get this message on most computers, but I have had a couple computers get either issue 1, or issue 2. Issue #1: I...
1
2066
by: mac | last post by:
I have a form already up and running for the last few years and someone did something to it. My form has part number and have 2 buttons, preview and print. If I click on either of them, I get...
1
719
by: Chuck | last post by:
I have a query that uses the query with the critera set to . We I run the query the msgbox pops up asking for the name information to be entered, but on the top (blue background) of the message box...
9
6975
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
0
1591
by: KGrein | last post by:
Hi. I have a form that contains a combo box with customer number & customer name in it. The form is called F_DeleteUSCust and the combo box is named CB_getUScust It picks up the information for...
11
7712
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and...
6
6688
by: ineedahelp | last post by:
I have been working on trying to get some code to work in an ON CLICK EVENT. I am having trouble with the syntax of an SQL statement. The program was stopped without running to completion many...
3
5430
by: myemail.an | last post by:
Hi all, I use Access 2007 and have come across this error a number of times. I have two tables (customer information) which should contain - ideally - the same data. I create a query to compare...
9
2261
by: junaidfaiz | last post by:
How can i get rid of "Enter Parameter Value" check boxes? as when i open my bill section there I have called multiple queries, forms and tables. It works perfectly fine. No error in calculation or...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
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...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.