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  

Retrieving the recordsource property of a report



 
 
Thread Tools Display Modes
  #1  
Old November 19th, 2005, 04:01 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Retrieving the recordsource property of a report

I need to get the recordsource property value (or even the SQL string itself
if possible) for any given report. I have tried all day and cannt figure it
out.

For what its worth, I have a custom report db that doesnt need to be linked
to the main db. I get the SQL string, create a make table query and output it
to the custom report db and the report runs. This keeps the record locks
down.

Any help is WAY appreciated.
--
Sean Henry
  #2  
Old November 19th, 2005, 04:35 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Retrieving the recordsource property of a report

Sean Henry wrote:

I need to get the recordsource property value (or even the SQL string itself
if possible) for any given report. I have tried all day and cannt figure it
out.

For what its worth, I have a custom report db that doesnt need to be linked
to the main db. I get the SQL string, create a make table query and output it
to the custom report db and the report runs. This keeps the record locks
down.

Any help is WAY appreciated.



You have to open the report to get the report's properties.
If you don't want the report to run, open it in design view.
OTOH maybe you can place the code to make the table in the
report's Open event??

--
Marsh
MVP [MS Access]
  #3  
Old November 19th, 2005, 04:52 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Retrieving the recordsource property of a report

On Fri, 18 Nov 2005 20:01:03 -0800, Sean Henry wrote:

I need to get the recordsource property value (or even the SQL string itself
if possible) for any given report. I have tried all day and cannt figure it
out.

For what its worth, I have a custom report db that doesnt need to be linked
to the main db. I get the SQL string, create a make table query and output it
to the custom report db and the report runs. This keeps the record locks
down.

Any help is WAY appreciated.


If you want just the record source of one known report:

DoCmd.OpenReport "ReportName", acViewDesign, , , acHidden
Debug.Print "Record Source: " & Reports!ReportName.RecordSource
Docmd.Close acForm, 'ReportName"

Or you can use the built in documenter (Tools + Analyze + Documenter)

or you can cycle through the containers and just print the
recordsource.

Public Sub RecordSource()
Dim doc As DAO.Document
Dim cont As DAO.Container
With CurrentDb
For Each cont In .Containers
If cont.Name = "Reports" Then
For Each doc In cont.Documents
DoCmd.OpenReport doc.Name, acViewDesign, , , acHidden
Debug.Print "Report Name: " & doc.Name
Debug.Print "Record Source: " &
Reports(doc.Name).RecordSource
Debug.Print
DoCmd.Close acReport, doc.Name
Next doc
End If
Next cont
End With
End Sub


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #4  
Old November 19th, 2005, 03:12 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Retrieving the recordsource property of a report

Thanks for the input

I cannot open the report in design mode because this is an mde file.

Cycling through I saw, but I only want to do this for one report at a time.
Is it possible to not cycle but find the specific report via this containers
method?

--
Sean Henry


"fredg" wrote:

On Fri, 18 Nov 2005 20:01:03 -0800, Sean Henry wrote:

I need to get the recordsource property value (or even the SQL string itself
if possible) for any given report. I have tried all day and cannt figure it
out.

For what its worth, I have a custom report db that doesnt need to be linked
to the main db. I get the SQL string, create a make table query and output it
to the custom report db and the report runs. This keeps the record locks
down.

Any help is WAY appreciated.


If you want just the record source of one known report:

DoCmd.OpenReport "ReportName", acViewDesign, , , acHidden
Debug.Print "Record Source: " & Reports!ReportName.RecordSource
Docmd.Close acForm, 'ReportName"

Or you can use the built in documenter (Tools + Analyze + Documenter)

or you can cycle through the containers and just print the
recordsource.

Public Sub RecordSource()
Dim doc As DAO.Document
Dim cont As DAO.Container
With CurrentDb
For Each cont In .Containers
If cont.Name = "Reports" Then
For Each doc In cont.Documents
DoCmd.OpenReport doc.Name, acViewDesign, , , acHidden
Debug.Print "Report Name: " & doc.Name
Debug.Print "Record Source: " &
Reports(doc.Name).RecordSource
Debug.Print
DoCmd.Close acReport, doc.Name
Next doc
End If
Next cont
End With
End Sub


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #5  
Old November 19th, 2005, 05:32 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Retrieving the recordsource property of a report

On Sat, 19 Nov 2005 07:12:02 -0800, Sean Henry wrote:

Thanks for the input

I cannot open the report in design mode because this is an mde file.

Cycling through I saw, but I only want to do this for one report at a time.
Is it possible to not cycle but find the specific report via this containers
method?


If it's an mde you can't open the report in design view, nor can you
write any code, so .... unless you have access to the original mdb I
can't suggest a way to do this.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #6  
Old November 19th, 2005, 05:40 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Retrieving the recordsource property of a report

I thought that might be the case. It is weird, I can set the property via
code int he repor,t but I cannot read the property without the object in
design mode.

Thanks for the help
--
Sean Henry


"fredg" wrote:

On Sat, 19 Nov 2005 07:12:02 -0800, Sean Henry wrote:

Thanks for the input

I cannot open the report in design mode because this is an mde file.

Cycling through I saw, but I only want to do this for one report at a time.
Is it possible to not cycle but find the specific report via this containers
method?


If it's an mde you can't open the report in design view, nor can you
write any code, so .... unless you have access to the original mdb I
can't suggest a way to do this.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reporting subreport total on main report BobV Setting Up & Running Reports 22 November 1st, 2005 03:19 AM
Printing Reports Access 2002 Pleas Advise Dermot Database Design 12 October 5th, 2005 11:23 AM
Exporting Report To Excel PK Setting Up & Running Reports 0 October 4th, 2005 03:49 PM
To Sharkbyte and all: Calculate a total values in group level Ally General Discussion 6 June 13th, 2005 08:16 PM
Is it possible to show both "Yes" and "No" answers from a "yes/no" checkbox? Colin Foster New Users 28 March 18th, 2005 02:19 PM


All times are GMT +1. The time now is 12:23 AM.


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