DanMonkey
04-25-2004, 05:38 AM
Hello there,
I have a filter form which I have no problem with coding the filter for the reports. But I can not link the filter form to the reports.
It is setup up so the filter form is opened first then the user sets the filter (checkboxes, combo boxes etc) and one of two buttons are pressed as required to create the different reports.
But I keep one getting an error saying that the name of the report I am trying to link to is mispelt of does or is not open. Please help. See my code below:
Filter form code:
Option Compare Database
'COMMENT: declaring Variables for reports
Dim m_rptSales As Report
Dim m_rptProducts As Report
//FIRST BUTTON//
Private Sub btnBUTTON1_Click()
// For Some reason instead of opening the report it starts to print !!//
DoCmd.OpenReport "rptProducts"
//This is the line that is highlight when error is thrown//
Set m_rptProducts = Reports("rptProductReport")
//This is where all of my filter requirements go //
MsgBox (strFilter)
With m_rptProducts
'COMMENT: setting the filter for the report
.Filter = strFilter
.FilterOn = True
End With
End Sub
Private Sub btnBUTTON2_Click()
// For Some reason instead of opening the report it starts to print !!//
DoCmd.OpenReport "rptSalesReport"
//This is the line that is highlight when error is thrown//
Set m_rptSales = Reports("rptSalesReport")
//This is where all of my filter requirements go //
With m_rptSales
'COMMENT: setting the filter for the report
.Filter = strFilter
.FilterOn = True
End With
End Sub
What am I doing wrong??
I have a filter form which I have no problem with coding the filter for the reports. But I can not link the filter form to the reports.
It is setup up so the filter form is opened first then the user sets the filter (checkboxes, combo boxes etc) and one of two buttons are pressed as required to create the different reports.
But I keep one getting an error saying that the name of the report I am trying to link to is mispelt of does or is not open. Please help. See my code below:
Filter form code:
Option Compare Database
'COMMENT: declaring Variables for reports
Dim m_rptSales As Report
Dim m_rptProducts As Report
//FIRST BUTTON//
Private Sub btnBUTTON1_Click()
// For Some reason instead of opening the report it starts to print !!//
DoCmd.OpenReport "rptProducts"
//This is the line that is highlight when error is thrown//
Set m_rptProducts = Reports("rptProductReport")
//This is where all of my filter requirements go //
MsgBox (strFilter)
With m_rptProducts
'COMMENT: setting the filter for the report
.Filter = strFilter
.FilterOn = True
End With
End Sub
Private Sub btnBUTTON2_Click()
// For Some reason instead of opening the report it starts to print !!//
DoCmd.OpenReport "rptSalesReport"
//This is the line that is highlight when error is thrown//
Set m_rptSales = Reports("rptSalesReport")
//This is where all of my filter requirements go //
With m_rptSales
'COMMENT: setting the filter for the report
.Filter = strFilter
.FilterOn = True
End With
End Sub
What am I doing wrong??