I have a report that is based on a query - it is essentially a calendar based report. I would like to limit it by month. Right now the reports underlying query has (among other things) a date field, and the report reflects all dates. I would like to have a form with a combobox (cboDate) that the user selects a Month and then presses a button to open the report.
As a test I made a form called frmTest. I added a combobox (cboMonth). The rowsource is a query to tblMonth. Bound Column is 2. this is the SQL for cboMonth:
SELECT tblMonth.Month, tblMonth.Range
FROM tblMonth;
tblMonth has 3 columns (and 12 rows):
col 1 = number (# 1 to 12 depending on row) (I used this to keep the months in the correct order)
col 2 (tblMonth.Month) = Month Name (displayed in cboMonth)
col 3 (tblMonth.Range) = text that depending on month is something like this.. "between #1/1/2005# and #1/31/05#" (for row 1)
anyway - I would like to have my reports (date) query based on the text in the 3rd column of tblMonth.
Since I am not a "guru" I sometimes will place a "test" button on a form and use the msgbox to display the test text I want to work with. In this case when cmdTest is pressed, I have this code:
MsgBox Me.cboMonth.Value
and it does in fact display my desired value (example "between #1/1/2005# and #1/31/05#"
in my reports query, in the criteria for the date field I entered this:
[Forms]![test]![cboMonth]
and also tried this:
[Forms]![test]![cboMonth].[value]
but neither works-
can someone please tell me what I am doing wrong, OR if you have a better way, please let me know.
Thanks,
PDUNCAN
Memphis, TN - USA
As a test I made a form called frmTest. I added a combobox (cboMonth). The rowsource is a query to tblMonth. Bound Column is 2. this is the SQL for cboMonth:
SELECT tblMonth.Month, tblMonth.Range
FROM tblMonth;
tblMonth has 3 columns (and 12 rows):
col 1 = number (# 1 to 12 depending on row) (I used this to keep the months in the correct order)
col 2 (tblMonth.Month) = Month Name (displayed in cboMonth)
col 3 (tblMonth.Range) = text that depending on month is something like this.. "between #1/1/2005# and #1/31/05#" (for row 1)
anyway - I would like to have my reports (date) query based on the text in the 3rd column of tblMonth.
Since I am not a "guru" I sometimes will place a "test" button on a form and use the msgbox to display the test text I want to work with. In this case when cmdTest is pressed, I have this code:
MsgBox Me.cboMonth.Value
and it does in fact display my desired value (example "between #1/1/2005# and #1/31/05#"
in my reports query, in the criteria for the date field I entered this:
[Forms]![test]![cboMonth]
and also tried this:
[Forms]![test]![cboMonth].[value]
but neither works-
can someone please tell me what I am doing wrong, OR if you have a better way, please let me know.
Thanks,
PDUNCAN
Memphis, TN - USA