Get recordsource from a report

  • Thread starter Thread starter s.wijen
  • Start date Start date
S

s.wijen

Guest
Hello,

I try to get a recordsource or the fields in the recordsource from a closed report or form.
The method Forms![name of form].recordsource will not work if the form is closed.
Does sombody now how to fix this problem.

Greetings Sjaak
 
Last edited:
Sorry, Keep the form open is not an option.
It has to be possible to check the recordsource from a form or report if the form is closed.
because in VBA is a ObjectExplorer (F2) and here is possible to select everting from a form without opening the form.
So there must be way in vb to do the same thing without opening the form or report.

Greeting Sjaak
 
Like this
(this is Access 2.0 code, it is about the same in Access 97 and 2K)


Dim myRpt As Report
Dim strQueryName As String

' Open the report and find the query that is the record source.
DoCmd OpenReport "YourReport", A_DESIGN
Set myRpt = Reports(ReportName)
strQueryName = myRpt.RecordSource
DoCmd Close A_REPORT, ReportName

NOTE: the users must have "Read Design" permission to Reports.

HTH,
RichM
 
Thanks Rich for your reaction.

But this is the reason why i do not want to open the Form or Report. There has to be a way to do this diferentley.

Sjaak
 
Sjaak,

Sounds like I don't understand what you are trying to do with the RecordSource of a closed form or report.

What are you trying to do?

RichM
 

Users who are viewing this thread

Back
Top Bottom