danikuper
Registered User.
- Local time
- Today, 06:39
- Joined
- Feb 6, 2003
- Messages
- 147
Hi there!
I've tried everything and can't figure out what's happening...
I have a query that has a criteria based on two combo-boxes I have in my form. Although the combo-box works and the field names are all correct, the query messes up.
Here's what I have for my query criteria related to a field in my table called "month":
>=[forms]![frmWeekly_comp_report].[combostartmonth] And <=[forms]![frmWeekly_comp_report].[comboendmonth]
I want the query to get me all records within the chosen months. When running the query, the results don't show the months I've selected. If I have "1" in my combostartmonth and "2" in my comboendmonth, the query gets a bunch of months in between (3, 4, 5...). (my field "month" has number for the months, from 1 to 12).
Does anyone know why this might be happening?
Here's the SQL code if that helps...
SELECT DISTINCTROW [Weekly comparison by year].Year, Sum([Weekly comparison by year].AmountConverted) AS SumOfAmountConverted
FROM [Weekly comparison by year]
WHERE ((([Weekly comparison by year].Month)>=[forms]![frmWeekly_comp_report]![combostartmonth] And ([Weekly comparison by year].Month)<=[forms]![frmWeekly_comp_report]![comboendmonth]))
GROUP BY [Weekly comparison by year].Year;
Note: if I substitute in the query design or directly to the sql statement the combo boxes for the numbers, the query runs perfectly!
Thanks in advance... I'm really frustrated with this.
I've tried everything and can't figure out what's happening...
I have a query that has a criteria based on two combo-boxes I have in my form. Although the combo-box works and the field names are all correct, the query messes up.
Here's what I have for my query criteria related to a field in my table called "month":
>=[forms]![frmWeekly_comp_report].[combostartmonth] And <=[forms]![frmWeekly_comp_report].[comboendmonth]
I want the query to get me all records within the chosen months. When running the query, the results don't show the months I've selected. If I have "1" in my combostartmonth and "2" in my comboendmonth, the query gets a bunch of months in between (3, 4, 5...). (my field "month" has number for the months, from 1 to 12).
Does anyone know why this might be happening?
Here's the SQL code if that helps...
SELECT DISTINCTROW [Weekly comparison by year].Year, Sum([Weekly comparison by year].AmountConverted) AS SumOfAmountConverted
FROM [Weekly comparison by year]
WHERE ((([Weekly comparison by year].Month)>=[forms]![frmWeekly_comp_report]![combostartmonth] And ([Weekly comparison by year].Month)<=[forms]![frmWeekly_comp_report]![comboendmonth]))
GROUP BY [Weekly comparison by year].Year;
Note: if I substitute in the query design or directly to the sql statement the combo boxes for the numbers, the query runs perfectly!
Thanks in advance... I'm really frustrated with this.