Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordsource for reports 1

Status
Not open for further replies.

shar

Technical User
Apr 2, 2000
54
IR
I have written SQL statements for changing form recordsource using VB code.&nbsp;&nbsp;How do you use SQL statements for changing&nbsp;&nbsp;report recordsource.<br><br>It seems the report must be in design view to be able to change the recordsource.&nbsp;&nbsp;However when I send it to screen view and then close the screen view report it comes up with a question that if I want to save the changes to the report design!<br><br>I do not want the end users get this message.<br><br>Is there a way to avoid this, or is there a better way of changing report recordsource?<br><br>Thanks.
 
Create your report as you want it, bound to a query, table, or SQL Statement.<br><br>When you are sure you have want you want, Remove the Record Source, and save the report.<br><br>In a module, create a public string, let's say gstrReportSQL.<br><br>After you have created your SQL String (I assume from a form), set gstrReportSQL equal to your created SQL String.<br><br>On the OnOpen event of the report, put the following:<br><br>Me.RecordSource = gstrReportSQL<br><br>This will work, do it all the time.<br><br>HTH<br> <p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top