report record source in vba

  • Thread starter Stephen Rossberg
  • Start date
S

Stephen Rossberg

I am struggling with something that I thought would be pretty simple. I am
trying to retrieve the recordsource of a report in a VBA module without the
report being
open. It seems that Reports only works with reports that are open.
Allreports works with everything but doesn't give me a way to recordsource.

any help appreciated.

Stephen
 
F

fredg

I am struggling with something that I thought would be pretty simple. I am
trying to retrieve the recordsource of a report in a VBA module without the
report being
open. It seems that Reports only works with reports that are open.
Allreports works with everything but doesn't give me a way to recordsource.

any help appreciated.

Stephen

Answered elsewhere.
Please do not multi-post. If you feel you must post the same question
to more than one newsgroup (and it's seldom necessary), cross-post by
adding each additional newsgroup in the To Newsgroups: box, separated
by a comma.
This way an answer in one newsgroup will be seen in each of the
others. More readers will see the response and learn, and less time
will be spent on duplicate answers.

See Netiquette at http://www.mvps.org/access

It's a great site to visit anyway.
 
T

tina

answered where, fred? i wanted to see the solution, but didn't find any
other posts with this subject or with the op's name. tia, tina
 
F

fredg

answered where, fred? i wanted to see the solution, but didn't find any
other posts with this subject or with the op's name. tia, tina


Subject: Recordsource property
microsoft.public.access.modulescoding

So you don't have to look it up, here was my reply:
*****
You just wish to retrieve the record source, not set it?

Dim strSource as String
Docmd.OpenReport "ReportName", acViewDesign
strSource = Reports!ReportName.RecordSource
DoCmd.Close acReport, "ReportName"
MsgBox strSource
*****
I just realize I should have hidden the report in design view.
Docmd.OpenReport "ReportName", acViewDesign, , , acHidden
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top