Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Monthly Inventory Report

8 views
Skip to first unread message

HubbyMax

unread,
Oct 11, 2009, 11:01:01 AM10/11/09
to
I am setting up an inventory program that requires a monthy billing report
that shows each departments totals for products ordered and what their monthy
charge is. This report must be divided by each department. Currently it says
there is a problem in the "FROM" line but has also said there is problems in
the "INNER JOIN" areas. My Database properties for this form is as follows.
The report is accessed by a date peramiter box;

SELECT DISTINCTROW Products2.StockNu, Products2.ProductName, Dept2.Cust2,
Dept2.DeptName, [Products2].AvgUnitPrice AS [Avg Unit Price],
Sum([Req1].QuantityIssued) AS [Total Units] FROM Products2 INNER JOIN (Dept2
INNER JOIN [Req1]. ON ([ Dept2].Cust2=[Req1].Cust) ON
Products2.StockNu=[Req1].StockNu2) WHERE
(([Req1].ReqFilledDate)<=forms![Report Date Range]!BeginDate) And
([Req1].ReqFilledDate<=forms![Report Date Range]!EndDate) GROUP BY
Products2.StockNu, Products2.ProductName, Dept2.Cust2, Dept2.Name;

Unfortunatly this does not work. My tables are:

Products2, holds all product info
Req1, holds requisition info from departments
Dept2, Info for all departments

Tom Wickerath

unread,
Oct 11, 2009, 4:26:01 PM10/11/09
to
Off-hand, it looks like you have an extra space character here, after the
first opening square bracket ( [ )

ON ([ Dept2].Cust2=[Req1].Cust)


Also, this inequality does not look correct to me:

WHERE (([Req1].ReqFilledDate)<=forms![Report Date Range]!BeginDate)

For the beginning date, shouldn't that be >= (greater than or equal to)
instead of <= (less than or equal to)?


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

HubbyMax

unread,
Oct 11, 2009, 7:31:01 PM10/11/09
to
Thanks. I will give it a try. You are correct. Just for info I am using
Access 2000. The string shoulod result in a product usage by department
withing the request dates grouped by Department. ONce agfain Thanks.

HubbyMax

unread,
Oct 11, 2009, 7:40:01 PM10/11/09
to
I made the corrections you pointed out and now it says I have a Syntax error
in the FROM clause. Not sure what I am looking for here.

AccessVandal via AccessMonster.com

unread,
Oct 11, 2009, 8:50:51 PM10/11/09
to
Is there a typo here, I see a missing field/column with the inner join "[Reg1]
."

FROM Products2 INNER JOIN (Dept2
INNER JOIN [Req1]. ON ([ Dept2].Cust2=[Req1].Cust) ON

^^^^^^

--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200910/1

Tom Wickerath

unread,
Oct 11, 2009, 9:31:01 PM10/11/09
to
The very last part of your SQL statement includes the following Group By
clause:

GROUP BY
Products2.StockNu, Products2.ProductName, Dept2.Cust2, Dept2.Name;

Do you really have a field named "Name"? If so, I recommend renaming this
such that you are not using any reserved words. Access MVP Allen Browne
maintains an extensive listing of reserved words here:

Problem names and reserved words in Access
http://allenbrowne.com/AppIssueBadWord.html

I recommend that for anything that you assign a name to within Access, that
you avoid special characters (spaces, #, etc.) and reserved words.

The other possibility is that your Group By clause should have included a
reference to DeptName instead of Name.

Try this SQL statement and see if it doesn't get you a little closer:

PARAMETERS [Forms]![Report Date Range]![BeginDate] DateTime,
[Forms]![Report Date Range]![EndDate] DateTime;


SELECT DISTINCTROW Products2.StockNu, Products2.ProductName, Dept2.Cust2,

Dept2.DeptName, Products2.AvgUnitPrice AS [Avg Unit Price],

Sum([Req1].QuantityIssued) AS [Total Units]

FROM Dept2
INNER JOIN (Products2
INNER JOIN Req1 ON Products2.StockNu = Req1.StockNu2)
ON Dept2.Cust2 = Req1.Cust
WHERE (((Req1.ReqFilledDate)>=[Forms]![Report Date Range]![BeginDate]
And (Req1.ReqFilledDate)=[Forms]![Report Date Range]![EndDate]))
GROUP BY Products2.StockNu, Products2.ProductName,
Dept2.Cust2, Dept2.DeptName, Products2.AvgUnitPrice;

HubbyMax

unread,
Oct 12, 2009, 10:37:08 AM10/12/09
to
I replaced the code I was using with yours. It now asks me to "Enter
Perameter Value" DEPT2. Also, I cut and pasted your code but it did leave
large blank spaces. Do I need to enter this code manually? I also want to
conferm that this coded goes in the DATA SORCE portion of the final form it
produces.

Tom Wickerath

unread,
Oct 12, 2009, 4:01:02 PM10/12/09
to
> I replaced the code I was using with yours. It now asks me to "Enter
> Perameter Value" DEPT2.

I'm not sure why you are getting this parameter, because I did not receive
anything similar. I had created the indicated tables, with the appropriate
fields, and a form ("Report Date Range") with the two text boxes for entering
dates. I didn't have any data in the tables, but the query seemed to run just
fine without producing a parameter prompt.

> Also, I cut and pasted your code but it did leave
> large blank spaces. Do I need to enter this code manually?

I did not supply any code; what I provided was a SQL (Structured Query
Language) statement. You could copy and paste that into the SQL View for a
new query.

> I also want to confirm that this coded goes in the DATA SORCE portion

> of the final form it produces.

I'm not following you here...

HubbyMax

unread,
Oct 12, 2009, 8:11:01 PM10/12/09
to
For some reason I can not get to your last reply again, I just get a blank
screen. I did creat a Quiry using your suggestion and was able to run it. It
produced a blank table showing the correct rows. I am not sure I am
explaining what I want clearly. I want the data from this to fill in a report
I have created showing the data sorted by department. This report is to be
used as a billing report for each department. This is why I placed it in the
DATA slot in the report properties.

Tom Wickerath

unread,
Oct 13, 2009, 1:56:01 AM10/13/09
to
I sometimes get the blank screen as well, when using the web portal as you
have been using. Try clicking on the other link which reads "Read the
Response". You can then click on the link that reads "Notify me of replies",
at which point you should see a sign-in dialog.

> I did creat a query using your suggestion and was able to run it.
That's good.

> It produced a blank table showing the correct rows.

Hmmm....a blank table should not have any rows. Did you mean "showing the
correct fields"?

> I want the data from this to fill in a report I have created showing
> the data sorted by department.

Okay, then save the query with a name that makes sense (I suggest not using
spaces, special characters or reserved words in this name). Then open the
report in design view, and display the properties dialog for the report.
Select the Data tab. Set the Record Source for the report to the name of the
query that you just saved.

To do the sorting part, click on View | Sorting and Grouping (Access 2003
and earlier--you'll need to hunt around on the ribbon for the same
functionality if you are using Access 2007). Add the Department field to this
dialog. If you want to group by department (rather than just sort) than add a
Group Header and/or Group Footer.

Note: Reports do not "obey" sort orders applied in queries; you must do the
sorting in the Sorting and Grouping dialog, in report design view.

HubbyMax

unread,
Oct 13, 2009, 7:40:01 PM10/13/09
to
WE are getting closer. Now after I enter the dates and pree the PREVIEW
button it asks me to enter a parameter for each field on the report. On the
report I have the following

Text box "DepartmentName" control sourse "Cust2"
Text box "ProductName" control sourse "Products2"
Currancy box "AvgUnitPrice" control sourse "Products2"
Number box "TotalUnits" control sourse "Req1"

After tabbing through the parameter requests it loads the form with the
correct start and end dates, and the correct Field titles but no data.

Tom Wickerath

unread,
Oct 14, 2009, 2:27:29 AM10/14/09
to
> WE are getting closer. Now after I enter the dates and press the PREVIEW

> button it asks me to enter a parameter for each field on the report.

You should only get these types of parameter prompts if there is a field
specified in the report that is not present in the Record Source (ie. your
query). With the report open in design view, click on View | Field List to
display a listing of the fields available to the report.

Is the following a typo? You've indicated two text boxes bound to the same
Products2 field:

> Text box "ProductName" control source "Products2"
> Currency box "AvgUnitPrice" control source "Products2"

Oh, Eureka! Aren't "Cust2", "Products2" and "Req1" the names of your tables?
You need to set the Control Sources to field names shown in the Field List,
not to the names of tables. So, try setting them as follows:

Text box "DepartmentName" control source "DeptName"
Text box "ProductName" control source "ProductName"
Text box "AvgUnitPrice" control source "Avg Unit Price"
Text box "TotalUnits" control source "Total Units"

By the way, have you installed Service Pack 3 for Access 2000 (since you
indicated previously that you are using this version)?


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

"HubbyMax" wrote:

> WE are getting closer. Now after I enter the dates and press the PREVIEW


> button it asks me to enter a parameter for each field on the report. On
the
> report I have the following
>

> Text box "DepartmentName" control source "Cust2"
> Text box "ProductName" control source "Products2"
> Currency box "AvgUnitPrice" control source "Products2"
> Number box "TotalUnits" control source "Req1"

Tom Wickerath

unread,
Oct 15, 2009, 12:07:48 PM10/15/09
to
Repeat of previously posted reply

> WE are getting closer. Now after I enter the dates and press the PREVIEW

> button it asks me to enter a parameter for each field on the report.

You should only get these types of parameter prompts if there is a field

specified in the report that is not present in the Record Source (ie. your
query). With the report open in design view, click on View | Field List to
display a listing of the fields available to the report.

Is the following a typo? You've indicated two text boxes bound to the same
Products2 field:

> Text box "ProductName" control source "Products2"
> Currency box "AvgUnitPrice" control source "Products2"


Oh, Eureka! Aren't "Cust2", "Products2" and "Req1" the names of your tables?
You need to set the Control Sources to field names shown in the Field List,
not to the names of tables. So, try setting them as follows:

Text box "DepartmentName" control source "DeptName"
Text box "ProductName" control source "ProductName"
Text box "AvgUnitPrice" control source "Avg Unit Price"
Text box "TotalUnits" control source "Total Units"


By the way, have you installed Service Pack 3 for Access 2000 (since you
indicated previously that you are using this version)?

Tom Wickerath

unread,
Oct 15, 2009, 12:07:04 PM10/15/09
to
Hello -

I replied last night, but the web portal is not currently showing this
reply. (I had to reply using the NNTP method, as the web portal was
"experiencing problems" -- these seem to have been corrected now).

Here is a link on Google Groups to this reply (see message # 11):
http://groups.google.com/group/microsoft.public.access/browse_frm/thread/c69c5f5b9d4cf1d0/970f157fa190e04a

HubbyMax

unread,
Oct 15, 2009, 12:23:13 PM10/15/09
to
Eureka is correct!!!!! I made the changes you suggested and all looks to be
OK. I found that the paramentor prompts was mostly due to my sort field
names. I had listed Table names there too. I do not have any data in my some
of the Tables yet so I'm not sure I will get the desired results but at least
I get directly to the form now. Thank you,thank you, THANK YOU!!!!

HubbyMax

unread,
Oct 16, 2009, 7:47:02 PM10/16/09
to
I have discovered that no data is being listed on the report. It does say the
correct starting date and end date but does not list anything that I know is
in the table.

Tom Wickerath

unread,
Oct 17, 2009, 2:46:01 AM10/17/09
to
Looks like the web interface is back on-line (finally)!

> I do not have any data in my some of the Tables yet so I'm not sure I
> will get the desired results but at least I get directly to the form now.

Your SQL statement includes INNER JOIN between the tables. This is also
known as an equi-join. In order for records to be returned with an inner
join, there must be matching records in each of the tables, based on the
joined fields.

You can use outer joins to show all records from one table, and matching
records from another table. Perhaps the easiest way to do this is to switch
your query from SQL View to normal design view. Then aim carefully and
double-click on a join line between two tables. You should see an option for
specifying join type. There are three join types available, with the default
being the equi (inner) join. Generally speaking, if you have the resulting
arrowheads for outer joins pointing away from a central table, you should be
okay. Often times, if you have join arrows pointing towards each other, you
will receive an ambiguous join error message. Play around with the various
join types and see if you can get the correct records returned.

> Thank you,thank you, THANK YOU!!!!

You're very welcome.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

"HubbyMax" wrote:

> Eureka is correct!!!!! I made the changes you suggested and all looks to be

> OK. I found that the parameter prompts was mostly due to my sort field

Hubbymax

unread,
Oct 17, 2009, 11:42:04 AM10/17/09
to
On Oct 16, 11:46 pm, Tom Wickerath <AOS168b AT comcast DOT net> wrote:
> Looks like the web interface is back on-line (finally)!
>
> > I do not have any data in my some of the Tables yet so I'm not sure I
> > will get the desired results but at least I get directly to the form now.
>
> Your SQL statement includes INNER JOIN between the tables. This is also
> known as an equi-join. In order for records to be returned with an inner
> join, there must be matching records in each of the tables, based on the
> joined fields.
>
> You can use outer joins to show all records from one table, and matching
> records from another table. Perhaps the easiest way to do this is to switch
> your query from SQL View to normal design view. Then aim carefully and
> double-click on a join line between two tables. You should see an option for
> specifying join type. There are three join types available, with the default
> being the equi (inner) join. Generally speaking, if you have the resulting
> arrowheads for outer joins pointing away from a central table, you should be
> okay. Often times, if you have join arrows pointing towards each other, you
> will receive an ambiguous join error message. Play around with the various
> join types and see if you can get the correct records returned.
>
> > Thank you,thank you, THANK YOU!!!!
>
> You're very welcome.
>
> Tom Wickerath
> Microsoft Access MVPhttp://www.accessmvp.com/TWickerath/

> __________________________________________
>
>
>
> "HubbyMax" wrote:
> > Eureka is correct!!!!! I made the changes you suggested and all looks to be
> > OK. I found that the parameter prompts was mostly due to my sort field
> > names. I had listed Table names there too. I do not have any data in my some
> > of the Tables yet so I'm not sure I will get the desired results but at least
> > I get directly to the form now. Thank you,thank you, THANK YOU!!!!- Hide quoted text -
>
> - Show quoted text -

I did as you suggested and chamged my table relationships. This
resulted in some data being entered into the report. The proper
Department Name was listed and the proper Product Name was listed. No
Avg Unit Price was listed and the Total Units field contained some
unknown entry "Ou1ber". Also, only the first Department in the Req1
table was shown. There are currently 2 records in that table.

Hubbymax

unread,
Oct 19, 2009, 4:11:40 PM10/19/09
to
On Oct 16, 11:46 pm, Tom Wickerath <AOS168b AT comcast DOT net> wrote:
> Looks like the web interface is back on-line (finally)!
>
> > I do not have any data in my some of the Tables yet so I'm not sure I
> > will get the desired results but at least I get directly to the form now.
>
> Your SQL statement includes INNER JOIN between the tables. This is also
> known as an equi-join. In order for records to be returned with an inner
> join, there must be matching records in each of the tables, based on the
> joined fields.
>
> You can use outer joins to show all records from one table, and matching
> records from another table. Perhaps the easiest way to do this is to switch
> your query from SQL View to normal design view. Then aim carefully and
> double-click on a join line between two tables. You should see an option for
> specifying join type. There are three join types available, with the default
> being the equi (inner) join. Generally speaking, if you have the resulting
> arrowheads for outer joins pointing away from a central table, you should be
> okay. Often times, if you have join arrows pointing towards each other, you
> will receive an ambiguous join error message. Play around with the various
> join types and see if you can get the correct records returned.
>
> > Thank you,thank you, THANK YOU!!!!
>
> You're very welcome.
>
> Tom Wickerath
> Microsoft Access MVPhttp://www.accessmvp.com/TWickerath/

> __________________________________________
>
>
>
> "HubbyMax" wrote:
> > Eureka is correct!!!!! I made the changes you suggested and all looks to be
> > OK. I found that the parameter prompts was mostly due to my sort field
> > names. I had listed Table names there too. I do not have any data in my some
> > of the Tables yet so I'm not sure I will get the desired results but at least
> > I get directly to the form now. Thank you,thank you, THANK YOU!!!!- Hide quoted text -
>
> - Show quoted text -

Ok, I now have all information showing up on the report but only for
the first record of the first group. It should show all requision data
for all requisions from that group, move to the next group, ext. Also,
in the req1 table each entry I record makes 3 or 4 records in the
table, 1 may have the Department infor with the forst item ordered,
and the next two will show just items ordered. I have been told I need
to table the department info out of the Req1 table as it is alkready
in the Department table and store only the requsition details, items
ordered, in a seperate table. These two tables should be joind in a
common field such as Requsition number. Is this correct?

Tom Wickerath

unread,
Oct 20, 2009, 2:34:01 AM10/20/09
to
Tell you what....if you can send me a copy of your database (preferably
compacted and zipped), I will take a look at it for you. If interested, send
me a private e-mail message with a valid reply-to address. My e-mail address
is available at the bottom of this page:

http://www.access.qbuilt.com/html/expert_contributors.html#TomW

Scroll down past the two pictures, to the bottom of the page, where you
should
see a clickable link. Please do not post your e-mail address (or mine) to a
newsgroup reply. Doing so will only attract the unwanted attention of
spammers.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/

PS. It looks like the "Notify me of replies" feature is not working (again -
<sigh>), when one makes a post via the web interface, and checks this option.
__________________________________________

0 new messages