A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

show select records in report



 
 
Thread Tools Display Modes
  #1  
Old December 11th, 2009, 06:14 PM posted to microsoft.public.access.reports
Cuda
external usenet poster
 
Posts: 14
Default show select records in report


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


  #2  
Old December 12th, 2009, 02:59 AM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default show select records in report

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" wrote in message
...

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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:53 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.