Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Report RecordSource


Message #1 by Manuel Martins <MMartins@A...> on Thu, 29 Nov 2001 21:27:47 -0000

 Hi,



 I have a ACCESS2K database, with a query with 2 parameters in a Date field:



		DateBeginning and DateEnd



 I also have a form to the users enter those values and carry them to the

query. Then I open the query with those values and I get a DAO recordset.

Now I want to open a report based on that recordset, but I don't know how...

:(

 Is a REPORT recordset a ADO recordset??? 



 any help will be appreciated!



 thanks in advance



 Manuel Martins





Message #2 by "Gregory Serrano" <SerranoG@m...> on Tue, 11 Dec 2001 21:25:48
Hola, Manuel.  ¿Qué tal?



<< I have a ACCESS2K database, with a query with 2 parameters in a Date 

field:



DateBeginning and DateEnd



I also have a form to the users enter those values and carry them to the 

query. Then I open the query with those values and I get a DAO recordset.  

Now I want to open a report based on that recordset, but I don't know 

how... >>



If you're asking how to open a report and restrict the report's record 

source based on a form's values, try using the DoCmd.OpenReport action.  

Suppose you have a form with a "Open Report" button on it.  With the 

OnClick Event, do this:



DoCmd.OpenReport "{report name here}", acPreview, ,"{Where clause here}"



The where clause is a typical SQL statement such as



"[DateBeginning] = #" & Me.[DateBeginning] & "# AND [DateEnd] = #" & Me.

[DateEnd] & "#"



This also assumes the report's record source is the same query as well.



¡Buena suerte!



Greg


  Return to Index