Hi John,
The cause of this problem is that you execute code to open the report but jump
to some other code before the report opens. Typically this other code is in the
OnOpen event of the report where you cancel opening the report. The cure to the
problem is to put the following line of code in the first code where you open
the report. Put it as the first line of code in your procedure:
On Error Resume Next
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource@pcdatasheet.com www.pcdatasheet.com
"John Martin" <jhmwine@aol.com> wrote in message
news:20040620181647.15941.00000226@mb-m21.aol.com...[color=blue]
> I am making my first attempt at a project using VBA and have hit a problem. I
> can find nothing to help in any book. My code is generating a message "Runtime
> error 2001 You canceled the previous operation."
>
> I created a relatively simple form, which allows the user to view and add
> details of patients. I put a filter option control on the form so that the
> patients could be filtered to those allocated to a chosen member of staff.[/color]
This[color=blue]
> worked perfectly.
>
> Afterwards, I created various reports and, finally, another form to select the
> particular report required with another filter option control to limit the
> selected report to the patients of a particular member of staff. This works as
> expected. I stopped for the day, well content.
>
> The next time I opened the project, I went to the first form and immediately
> received the error message mentioned when I tried to impose the filter to the
> chosen member of staff. What operation have I cancelled? At this stage, I have
> not run any other code. Only removing the second form and its code makes the
> first form work again without generating the error.
>
> It seems that there is no "help" available from the program.
> I would appreciate any assistance.
>
> John Martin[/color]