Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Message

Status
Not open for further replies.

haoose

Technical User
Dec 22, 2003
15
US
Hi Everyone,

I have created a report that when selected prompts the user for a range of dates (which are entered in a Form). Everything seems to be okay except when a user closes the form or exits from the form before entering any dates.

When a user closes the form a generic entry box containing the criteria I entered in the query for the dates appears. I have also tried to add some code in the Form_close() function to close the form and the report called so that this entry box does not appear, but I get the following message:
"This action can't be carried out while processing a form or report event".

Thank you in advance.
 
Hi

If I undertstand you correctly, you have a rport which is based on a query, that query has criteria which are controls on a form - right?

In order for this to work the Form must be open at the time the report runs, if the form is not open and you run the report, it will prompt for the criteria values (which is what is happening).

So what is happening is expected behaviour

What is it you want to happen ?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi Ken,

Thanks for the reply. Let me try and clear up a few things so that you can help me better.

Yes, I have a report based on a query, which has criteria, for which the values are found on a form.

Now, the way I have it set up, when I double click (or open) a report first my form pops up and awaits for the values...let's say BeginDate and EndDate. These values are passed to the query and the report is generated. In this case everything works fine.

BUT, if a close the form (either by clicking on the 'X' in the top right hand corner, or by creating a command button that closes the form), another entry box appears. This second entry box is NOT a form. Across the top of the box is the criteria expression I entered in the query.

So basically what I am trying to do is eliminate that second pop up box from appearing when I cancel or close the form (which to me implies that the user no longer wants to view the report). What I tried doing is writing some code (and also creating macros) that when a user cancels/closes the form the report that was selected to be generated will also be canceled/closed.

Thank you again for your help. I appreciate any tips.
 
Hi

As I said, this is 'expected behaviour', the easiest solution is when you run the report from the form, in the on open event of the report, make the form invisible (user cannot then close the form while report is open), in the on close event of the report make the form visible again, thus allowing user to close the form or run the report again with different criteria

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken,

Got it. Now just one last question how do I make the form invisible. Is the following code correct?

Private Sub Report_Close()
....
....
Me.Visible = False
End Sub

and then
Private Sub Report_Open()
....
....
Me.Visible = True
End Sub

Thanks Again. I think I understand now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top