View Single Post
  #4  
Old June 3rd, 2010, 08:05 AM posted to microsoft.public.access
Wolfgang Kais[_4_]
external usenet poster
 
Posts: 18
Default How to select all months from a table to include in a report

Hello Frank.

"FSHOTT" wrote:
[snip] The problem is I have a "AllMonths" entry in the Month combo
list which I would like to include all month rows for the specific
supplier and year in the report. I have tried [snip]
1) SELECT * FROM qryPurchasingTable WHERE
((MyYear=Forms!frmSupplierReportCardEmailForm!cboY ear) Or
(Forms!frmSupplierReportCardEmailForm!cboYear Is Null)) And
(IIf(Forms!frmSupplierReportCardEmailForm!cboMonth ="AllMonths",
(MonthNo Between 2 And 11),
(MyMonth=Forms!frmSupplierReportCardEmailForm!cboM onth)))
And (SupplierNo=GetSupplierID()); [snip]


Wolfgang Kais wrote:
SELECT * FROM qryPurchasingTable WHERE
((MyYear=Forms!frmSupplierReportCardEmailForm!cboY ear) Or
(Forms!frmSupplierReportCardEmailForm!cboYear Is Null)) And
((Forms!frmSupplierReportCardEmailForm!cboMonth="A llMonths") Or
(MyMonth=Forms!frmSupplierReportCardEmailForm!cboM onth)) And
(SupplierNo=GetSupplierID());


"FSHOTT" wrote:
Wolfgang Thank You for the response. Unfortunately it does not
generate a report for all the months of the specified year.
The SELECT query has 0 rows instead of all the month rows of data
for the ID'd year.


Now, I see that you seem have two month columns in your query:
MonthNo (seems to be the number of the month, an integer from 1 to 12)
and MyMonth, which has to be a value that can be compared to the
value that is selected in the ComboBox.
To find out, what values the query fields have and what the value
of the comboBox is, try this query first:

SELECT *, Forms!frmSupplierReportCardEmailForm!cboMonth
FROM qryPurchasingTable WHERE
((MyYear=Forms!frmSupplierReportCardEmailForm!cboY ear) Or
(Forms!frmSupplierReportCardEmailForm!cboYear Is Null)) And
(SupplierNo=GetSupplierID());

Does the query return any records at all? If so, what are the values
of MyMonth, MonthNo and the last column? Try this with different
selections in the ComboBox, for example once with "January" and
then with "AllMonths". What does the last column show?

--
Regards,
Wolfgang