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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with reports/forms

Status
Not open for further replies.
Jun 1, 2006
58
US
Hi all,

I have a form which contains a report that is based on a query. When I run the query itself, it works with no problem at all. But when I try to run the same query from the form, I get a message saying the expression is too complex to be evaluated........

I think the problem is with this line of code..

abd=Forms!frmReport!txtabd;

where the value in the form is supposed to be an integer, usually 0. When I input a 0 from the form, I get the error. but when I run the query as is, inputting a 0, i get the results.

Can anyone please tell me what is wrong with my form?

thanks,
 
can you check the contents of Forms!frmReport!txtabd at the point of the report being run?

also, is abd=Forms!frmReport!txtabd part of the query code or part of the form code?

--------------------
Procrastinate Now!
 
It is part of the query code.


When I input a 0 in the form, it gives me that error. But, when I give a different value, like a 1, it seems to be running. This is happening only when I use the form to generate the report.

When I use the query, I can input 0 and it still works.
 
A form that contains a report?
What exactly are you trying to do with this work? Sounds like a "conditional" set up you are trying to accomplish. *You wrote code for generating a report from a query?
*Was your FORM created from the query? If so, it inherits the format from the query.
*I don't believe reports are generated based on FORMS.

Does this help? I might not have any idea of what I'm talking about. If I do, I might be able to help you, can you tell me any more about how your DB is set up?
 
Hi,

Well..what I was trying to say earlier was that I have two reports that are generated based on queries (obviously). As a user interface, I have a form where in users can enter parameters which are passed to the query, which will then generate the report. That is the set-up.

When I try to input parameters into the form and generate the report, I get an error saying "the expression is too complicated..etc..etc..'. But, instead of using the form, if I run the query directly, there is no such problem.

After doing some debugging, I narrowed the problem down to one particular field, which takes in a number (integer) as a parameter. This field is stored as a number in the table, and is in the format of a number in the form as well.

So, when I enter the value 0 in this field, it should work, except it throws the error.

I hope this is slightly better explanation. The last time I was in a hurry, so I might have written gibberish.

Your help is appreciated.
 
Well, I think I've gotten the setup, tell me if I'm right.
You have a FORM that was made from a table, and a query relating to that table. Then I assume you have written code to aid the process of "parameter - FORM (table) - query - result"

If you create a FORM from any kind of datasheet, it automatically copies the formatting of that sheet and defaults to it in the FORM itself.

I assume that you have tried to generate this report entirely by code, and not by any other means such as linking, startup functions, properties, etc. That's just an idea, I'm not sure if you're able to by using those tools or not. My guess is that you could.

Remember, a FORM takes on the exact formatting as the datasheet it references, that's automatic. The only other thing I would check is this specific field's property menu in the FORM, or perhaps the related query's properties. I've set some criteria in the past in these two items that made perfect sense, but jumbled the DB up, so much so that one time I had to create an entire new DB from scratch, and I'm talking about MINOR property and functionality changes within DB items.

It's also possible that Access just doesn't function like that. Your FORM is basically a datasheet, but with a different interface, correct? If it is, the above sentence might be true, and you can't do anything. If you're talking about a FORM that looks like a switchboard, with buttons and links and such, that might function a different way....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top