crumpms
07-09-2008, 11:55 AM
Hi everyone,
I've got a form (named REPORTPOPUP) with 3 unbound combo boxes (cboClients, cboMonth and cboYear) that get their lists from queries. For example, my "clients" combo box has the following query:
SELECT [CLIENTS].[ID], [CLIENTS].[FNAME], [CLIENTS].[LNAME], [CLIENTS].[ACTIVE] FROM CLIENTS WHERE ((([CLIENTS].[ACTIVE])=[Forms]![REPORTPOPUP]![chkActiveClient]));
This correctly gives me all of my "active/current" clients in my clients table. The Month and Year combo boxes give me month and year information about the selected client.
What I want to do is make my combo box selections on the form, click a button that runs a query based on these selections and then opens a report to display the query results.
I created a query (qryClient_Monthly_Report) with fields from the table. I also created a report (rptClient_Monthly_Report) based on this query. When I click my button on the form it opens the report based on the query.
If I put in no criteria, the query correctly returns the rows of data from the table that match my query fields and it is correctly displayed when my report is opened.
If I "hard-wire" a client name, month and year in the criteria fields, it correctly returns the query result for the name, month and year I put in and, again, correctly displays the data in my report.
Here's where I start to have my problem:
If I link my query criteria to the combo boxes on the form, the report displays no data. For example, in the client criteria I have [Forms]![REPORTPOPUP]![cboClients].
The Month criteria is [Forms]![REPORTPOPUP]![cboMonth].
And the year is [Forms]![REPORTPOPUP]![cboYear]
When I make my combo box selections and click the button and open the report, I have no results listed in the report.
The click event for my button is:
Private Sub btnPreviewReports_Click()
On Error GoTo Err_btnPreviewReports_Click
Dim stDocName As String
stDocName = "rptClient_Monthly_Report"
DoCmd.OpenReport stDocName, acPreview
Exit_btnPreviewReports_Click:
Exit Sub
Err_btnPreviewReports_Click:
MsgBox Err.Description
Resume Exit_btnPreviewReports_Click
End Sub
What am I doing wrong? :confused:
Thanks!
I've got a form (named REPORTPOPUP) with 3 unbound combo boxes (cboClients, cboMonth and cboYear) that get their lists from queries. For example, my "clients" combo box has the following query:
SELECT [CLIENTS].[ID], [CLIENTS].[FNAME], [CLIENTS].[LNAME], [CLIENTS].[ACTIVE] FROM CLIENTS WHERE ((([CLIENTS].[ACTIVE])=[Forms]![REPORTPOPUP]![chkActiveClient]));
This correctly gives me all of my "active/current" clients in my clients table. The Month and Year combo boxes give me month and year information about the selected client.
What I want to do is make my combo box selections on the form, click a button that runs a query based on these selections and then opens a report to display the query results.
I created a query (qryClient_Monthly_Report) with fields from the table. I also created a report (rptClient_Monthly_Report) based on this query. When I click my button on the form it opens the report based on the query.
If I put in no criteria, the query correctly returns the rows of data from the table that match my query fields and it is correctly displayed when my report is opened.
If I "hard-wire" a client name, month and year in the criteria fields, it correctly returns the query result for the name, month and year I put in and, again, correctly displays the data in my report.
Here's where I start to have my problem:
If I link my query criteria to the combo boxes on the form, the report displays no data. For example, in the client criteria I have [Forms]![REPORTPOPUP]![cboClients].
The Month criteria is [Forms]![REPORTPOPUP]![cboMonth].
And the year is [Forms]![REPORTPOPUP]![cboYear]
When I make my combo box selections and click the button and open the report, I have no results listed in the report.
The click event for my button is:
Private Sub btnPreviewReports_Click()
On Error GoTo Err_btnPreviewReports_Click
Dim stDocName As String
stDocName = "rptClient_Monthly_Report"
DoCmd.OpenReport stDocName, acPreview
Exit_btnPreviewReports_Click:
Exit Sub
Err_btnPreviewReports_Click:
MsgBox Err.Description
Resume Exit_btnPreviewReports_Click
End Sub
What am I doing wrong? :confused:
Thanks!