Prev: Using a query as base for report
Next: Page Footer
From: Cuda on 11 Dec 2009 13:14 Shows every record: Private Sub Report_Open(Cancel As Integer) Dim stDocName As String Dim strInvoicing As String Dim strSites As String strInvoicing = "InvPercent" strSites = "Base List.Subform!SiteComplete" Shows one page of report but fields are blank.... Private Sub Report_Open(Cancel As Integer) Dim stDocName As String Dim strInvoicing As String Dim strSites As String strInvoicing = "InvPercent" strSites = "Base List.Subform!SiteComplete" stDocName = "Open Projects" DoCmd.OpenReport stDocName, acPreview, wherecondition:=strInvoicing & strSites = "<1" End Sub stDocName = "Open Projects" DoCmd.OpenReport stDocName, acPreview, wherecondition:=strInvoicing <= 1 & strSites <= 1 End Sub
From: Allen Browne on 11 Dec 2009 21:59 Don't follow what you are doing. You're trying to open a report in its Open event, i.e. while it's already opening? Are you trying to filter the report? If so, some alternatives: a) Use another event (such as the Click of a command button on a form) to open the report with a WhereConditon. Examples: http://allenbrowne.com/casu-15.html http://allenbrowne.com/casu-08.html b) Set the report's Filter in its Open event, e.g.: Dim strWhere As String strWhere = "[City] = ""New York""" 'Debug.Print strWhere Me.Filter = strWhere Me.FilterOn =True For (b), your filter string needs to include a field name and a value to match. It needs to look like the WHERE clause in a query. To see how it should look, mock up a query, switch to SQL view, and look at the WHERE clause. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Cuda" <Cuda(a)discussions.microsoft.com> wrote in message news:2E35A71B-1DD2-4A79-B428-3480A579AB5C(a)microsoft.com... > > Shows every record: > Private Sub Report_Open(Cancel As Integer) > Dim stDocName As String > Dim strInvoicing As String > Dim strSites As String > > strInvoicing = "InvPercent" > strSites = "Base List.Subform!SiteComplete" > > Shows one page of report but fields are blank.... > Private Sub Report_Open(Cancel As Integer) > Dim stDocName As String > Dim strInvoicing As String > Dim strSites As String > > strInvoicing = "InvPercent" > strSites = "Base List.Subform!SiteComplete" > > stDocName = "Open Projects" > DoCmd.OpenReport stDocName, acPreview, wherecondition:=strInvoicing & > strSites = "<1" > End Sub > > > stDocName = "Open Projects" > DoCmd.OpenReport stDocName, acPreview, wherecondition:=strInvoicing <= > 1 > & strSites <= 1 > End Sub > >
|
Pages: 1 Prev: Using a query as base for report Next: Page Footer |