Which is better - queries or sub/Function

A

anil

hi all

I need one advice to select in between queries or vba.
I have to prepare one report on basis of results that I have got.Tables
needed are

tblResults(ResultID,ParameterID,ResultValue,ResiltIsPass,---------)
tblLocation(locationID,LocationName---------)tblSample(SampleID,SampleNO,--­--)


So output I need as
(LocationID,Year,Month,ParameterID,NoofSamples,Monthlyresult,YearlyResult)


Here user is getting year and month from form.In report i need only 9
parameters out of 50.So I am using query to select all 9 and then work
forward.It also involved mean, max,stddev and Count which is not easily
managed in VBA.
The problem is Each parameter has different calculation for monhly and
yearly result.
e.g parameter A has monthly result in % ,Parameter B has mean
value,Parameter C has Small Calculation involved like(mean + Stddev) in

yearly result and so on.
Also 3 parameter have results in 3 decimal places,3 in 2 decimal
places,2 in 1 decimal places,1 in %.

I have written all of them in queries and that comes to 30
queries,because 1 of monthly,1 yearly,1 combination of both.which looks
too much.it took 25 secs to run from form.I want to fix them in program
so that they will not be seen.

But writting in program is not working fine and giving regular problems
as we have to select date from form(parameter query).
Which way is better - in queries or Functions/Sub.in terms of
functionality, performance and safety.

one more Thing - Can I do like this .Have Main Database-A and Result
database - B,
- may be linked tables.So when I click Result button in form of
Database A It gets the results from Database B and give Report Preview
or DataSheet View in Database A

Thanks
anil
 
A

Alex Dybenko

hi,
not quite understand all your calculations, but in general - using queries
is more efficient way. Of course - you can also combine queries and
functions, and even temporary tables

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com



hi all

I need one advice to select in between queries or vba.
I have to prepare one report on basis of results that I have got.Tables
needed are

tblResults(ResultID,ParameterID,ResultValue,ResiltIsPass,---------)
tblLocation(locationID,LocationName---------)tblSample(SampleID,SampleNO,--­--)


So output I need as
(LocationID,Year,Month,ParameterID,NoofSamples,Monthlyresult,YearlyResult)


Here user is getting year and month from form.In report i need only 9
parameters out of 50.So I am using query to select all 9 and then work
forward.It also involved mean, max,stddev and Count which is not easily
managed in VBA.
The problem is Each parameter has different calculation for monhly and
yearly result.
e.g parameter A has monthly result in % ,Parameter B has mean
value,Parameter C has Small Calculation involved like(mean + Stddev) in

yearly result and so on.
Also 3 parameter have results in 3 decimal places,3 in 2 decimal
places,2 in 1 decimal places,1 in %.

I have written all of them in queries and that comes to 30
queries,because 1 of monthly,1 yearly,1 combination of both.which looks
too much.it took 25 secs to run from form.I want to fix them in program
so that they will not be seen.

But writting in program is not working fine and giving regular problems
as we have to select date from form(parameter query).
Which way is better - in queries or Functions/Sub.in terms of
functionality, performance and safety.

one more Thing - Can I do like this .Have Main Database-A and Result
database - B,
- may be linked tables.So when I click Result button in form of
Database A It gets the results from Database B and give Report Preview
or DataSheet View in Database A

Thanks
anil
 

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

Similar Threads


Top