Command not available in MDE/ADE

D

DJ

My database provides an option to print a form, however, in order to change
the record source for the report on the fly, I first open the report in
design view to select the correct query. See below:


stRecSrc = "SingleSheet"

DoCmd.OpenReport "Event", acViewDesign
Reports!Event.RecordSource = stRecSrc
DoCmd.Close acReport, "Event", acSaveYes
DoCmd.OpenReport "Event", acPreview

The report works fine when the DB is saved as an MDB, however, If I use it
as an MDE if fails due to "command not available in MDE". I presume this is
because I am attempting to open the report in edit mode temporarily. I need
to select the record source on the fly because I am using the report format
repeatedly for varying selections of data.

Is there any simple way around this?
 
R

Rick Brandt

DJ said:
My database provides an option to print a form, however, in order to
change the record source for the report on the fly, I first open the
report in design view to select the correct query. See below:


stRecSrc = "SingleSheet"

DoCmd.OpenReport "Event", acViewDesign
Reports!Event.RecordSource = stRecSrc
DoCmd.Close acReport, "Event", acSaveYes
DoCmd.OpenReport "Event", acPreview

The report works fine when the DB is saved as an MDB, however, If I
use it as an MDE if fails due to "command not available in MDE". I
presume this is because I am attempting to open the report in edit
mode temporarily. I need to select the record source on the fly
because I am using the report format repeatedly for varying
selections of data.

Is there any simple way around this?

You do not need to open in design view unless you want to *permanently*
change the RecordSource. If you just change it in the Open event of the
report then you do not need design view and it will work just fine in an
MDE.

All you need is a global variable or a value in an open form, something that
the Open event can use to determine what RecordSource it should switch to.
 
D

DJ

Thanks for that. I'll give it a try.

Rick Brandt said:
You do not need to open in design view unless you want to *permanently*
change the RecordSource. If you just change it in the Open event of the
report then you do not need design view and it will work just fine in an
MDE.

All you need is a global variable or a value in an open form, something that
the Open event can use to determine what RecordSource it should switch to.
 

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