Brad Marks
BradM at blackforestltd.com
Fri May 14 15:02:57 CDT 2010
Rocky, Below is the code that I started with that someone shared with me. I later defined a table and added rows to this table instead of displaying the data with the msgbox. I then put together a simple query and report to show the data stored in the table. Nothing fancy, but quite useful for our purposes. Brad '~~~~~~~~~~~ Start of code ~~~~~~~~~~~~~~~~ Sub ListReportRecordSources() ' List the recordsources of all reports. On Error GoTo Err_Handler Dim db As DAO.Database Dim doc As DAO.Document Dim lngReportCount As Long msgbox "*** Beginning scan of Reports for Record Source field " Set db = CurrentDb For Each doc In db.Containers("Reports").Documents DoCmd.OpenReport doc.Name, acDesign, WindowMode:=acHidden With Reports(doc.Name) lngReportCount = lngReportCount + 1 msgbox "Report " & .Name & " RecordSource: " & .RecordSource DoCmd.Close acReport, .Name End With Next doc Exit_Point: Set doc = Nothing Set db = Nothing msgbox "*** Scanned " & lngReportCount & " reports." Exit Sub Err_Handler: MsgBox Err.Description, vbExclamation, "Error " & Err.Number Resume Exit_Point End Sub '~~~~~~~~~~~ End of Code ~~~~~~~~~~~~~~~~ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: Friday, May 14, 2010 2:26 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Report / Query Cross Reference Can you post the code? Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks Sent: Friday, May 14, 2010 12:03 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Report / Query Cross Reference THANKS! With the help/advice from this group, I was able to put together a little utility that will nicely meet our needs. I appreciate the assistance. Brad ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Friday, May 14, 2010 12:46 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Report / Query Cross Reference Brad: But you can use a common external Public function to set the parameters, data source, headers etc which will be called from the running Reports through the OnOpen Event. Jim -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of roz.clarke at barclays.com Sent: Friday, May 14, 2010 7:49 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Report / Query Cross Reference Brad, I can confirm that you do need to open a report before you can access its recordsource (same for forms). This should do it: Dim rpt As Report Dim strReportName as string For Each rpt in Application.CurrentProject.AllReports strReportName = rpt.Name If IsLoaded(strReportName) = False Then DoCmd.OpenReport ReportName:=strReportName, View:=acDesign End If debug.print rpt.recordsource DoCmd.Close acReport, rpt.Name, acSaveNo Next Roz -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: 14 May 2010 14:41 To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Report / Query Cross Reference Brad: Here's a bit of code that will cycle through all the reports, and show the report name, but I don't know how to get the record source. I think you may have to open the report in design view to extract that property. At that point I'd write the report name and record source to a temp table and print the report from the table. Dim Doc As Document Dim db As DAO.Database Set db = CurrentDb With db.Containers("reports") For Each Doc In .Documents MsgBox Doc.Name Next Doc End With HTH Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks Sent: Friday, May 14, 2010 4:15 AM To: accessd at databaseadvisors.com Subject: [AccessD] Report / Query Cross Reference We have a growing number of Access 2007 Reports. All reports use Queries for their Record-Source. Is it possible to create a simple and concise cross-reference report that shows Report Name and Record Source? In our case this would be a query name. Here is a small sample of what we would like to see. ~~~~~~~~~~~~~~~~~~~~~~~~~~ REPORT-NAME RECORD-SOURCE(QUERY) Report001 Query098 Report002 Query499 Report003 Query372 ~~~~~~~~~~~~~~~~~~~~ We have looked at the Access 2007 internal "sys" tables, but cannot figure out how to obtain this info (or if this is even possible). We know that we can obtain this info via the Database Documenter, but the report from this tool contains way more info than we need. There is probably a simple way to do this, but we cannot figure it out. Thanks, Brad -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com This e-mail and any attachments are confidential and intended solely for the addressee and may also be privileged or exempt from disclosure under applicable law. If you are not the addressee, or have received this e-mail in error, please notify the sender immediately, delete it from your system and do not copy, disclose or otherwise act upon any part of this e-mail or its attachments. Internet communications are not guaranteed to be secure or virus-free. The Barclays Group does not accept responsibility for any loss arising from unauthorised access to, or interference with, any Internet communications by any third party, or from the transmission of any viruses. Replies to this e-mail may be monitored by the Barclays Group for operational or business reasons. Any opinion or other information in this e-mail or its attachments that does not relate to the business of the Barclays Group is personal to the sender and is not given or endorsed by the Barclays Group. Barclays Bank PLC.Registered in England and Wales (registered no. 1026167). Registered Office: 1 Churchill Place, London, E14 5HP, United Kingdom. Barclays Bank PLC is authorised and regulated by the Financial Services Authority. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.