calculations in forms vs queries?

  • Thread starter Thread starter Howard
  • Start date Start date
H

Howard

I have a number of calculations that build on each other , originally based
on some fields and I need the interim results as well as the final one. I
also at one point use a function that I wrote myself and is held in a
module. Now, I can do all these calcs in a control on a form or I can do it
in the forms query and just present the values I want to the form.

Which is the best way and why?

Also, is it 'better' to write a query and use that as the source for a form
or report or is it better to build the query directly in the form or
report's data source property?
(I must admit in assess 2003 I do the former as trying to execute sql in a
control's data source usually crashes access 2003 - not so 2000)

Howard
 
Dear Howard:

My guess is that, for the sake of performance, it make so little difference
that is it not worth wondering about.

As a matter of style, the difference is also somewhat arbitrary. However,
query work is more difficult for most programmers, so keeping the length and
complexity of queries to a minimum is a positive advantage to most
programmers. So, for most, doing calculations in a control is preferable.

For those who are more advanced in query writing, the preferred solution
would probably be to put the calculations in the query. For me, it is nice
to arrange a query for a form or report so it shows the same columns, in the
same order, in final form for the finished product. Rather complex queries
written this way can run 2 or 3 printed pages in length. When I write such
a query, it is always for MSDE/SQL Server, and contains considerable
commenting, a feature that is not available in Jet queries.

So, I recommend you do what is most comfortable for you. If you work in an
environment where there are many programmers who may need to touch your code
later, I suggest you discuss this with the most senior programmers there,
and perhaps find a style most suited to everyone.

Tom Ellison
 
Back
Top