The way the ProductOfKolicina function is written it handles only the
specific columns from the Sheet1 table, so you'll need to create a separate
function of a different name to handle the column in the other table by
changing the table and column names in the function as necessary.
You should then be able to call both functions as separate computed columns
in the query which includes the two tables. You don't sat how these tables
are related, however. If the relationship is one-to-many you'll get the
values from each row of the table on the 'one' side (the referenced table)
for each instance of a matching row in the table on the 'many' side (the
referencing table). This should not affect the product values returned in
the computed columns, however, as the functions will act independently for
each row returned. You'll get repeated values of the product from the
referenced table, but the value will be the correct one in each case.
If the tables are not related a UNION ALL query might be a more appropriate
solution. This in effect tacks the rows returned by one query onto those
returned by another, so if one query returns 20 rows and the other 30, the
UNION ALL of them would return 50 rows. Whether this is a suitable approach
depends on just what you want from the query when you include both tables.
The first thing to do is to create the second function for handling the data
from Sheet2 and then test it in a simple query which uses Sheet2 only. If
that works then you can either JOIN the tables in a query or create a UNION
ALL query which combines the results from both tables. Before I can advise
you on which of these ways to go, however, I'll need a fuller explanation of
just what you want the query to return. As usual a few dummy rows from each
table and how you'd want these to be reflected in the query's result table
would be the best way of showing us what's required.
Ken Sheridan
Stafford, England
Ok, I bumped into a problem. Now I'd like to choose another grouping column
instead of 'Vrsta VP', which is in another table ('Sheet2') and is called
'Instrument' (also Text type). I tried to modify the function but without
success (query now has 2 tables and I can't put it in sql function).
Help?
thanks
"sajonara" je napisal:
It works! Man, you saved me a lot of trouble, and kinda opened my eyes into
Sql world that seems like an interesting thing to take a deeper insight.
[quoted text clipped - 31 lines]
is there some other way to do it?
Thanks
--
Message posted via AccessMonster.com
.