Report RecordSource

W

Warrio

Hello!!

Is it possible to change a report's recordsource before open it?

when I click on buton located on my form, I have the following code:

Report_myReport.RcordSource = "Select * from my Table"
DoCmd.OpenReport "myReport, acPreview

The code runs untill the line where the recordsource is changed and an
Visual C++ Runtime error appears and tells that Access asks to close the
application.

and then MS Access closes!!

Is there an easy way to change the RecordSource of a report before
despalaying the report???
 
M

Marshall Barton

Warrio said:
Is it possible to change a report's recordsource before open it?

when I click on buton located on my form, I have the following code:

Report_myReport.RcordSource = "Select * from my Table"
DoCmd.OpenReport "myReport, acPreview

The code runs untill the line where the recordsource is changed and an
Visual C++ Runtime error appears and tells that Access asks to close the
application.

and then MS Access closes!!

Is there an easy way to change the RecordSource of a report before
despalaying the report???

No! You have to set the recordsource property from within
the report's Open event.
 

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