🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.databases.ms-access
2 messages
2 total messages Started by Karl Voit Tue, 28 Oct 1997 00:00
Q: MISC questions
#43
Author: Karl Voit
Date: Tue, 28 Oct 1997 00:00
89 lines
3234 bytes

Hi!

The manuals are very confusing to me and so I have to ask some
Access2.0-freaks to help me on these problems:

(btw, I am speaking german and my Access2.0 too :-)
 So please ignore the mistakes I made in the translation.)



I've got an endless-form for my telephone-database:

room:  number of the room (1-4)
date:  date of the call
cost:  cost of the telephone-call
sum:   number of received impulses so far (1 pulse received -> +0.8 costs)
text:  -
sheet: number of the sheet, on which the call was noticed


Problem 1:
I want to calculate the cost by multiplying the difference of the sum by 0.8
e.g.: cost = ( sum - sum.old ) * 0.8
So, how do I refer to the sum.old-field?
Can I just enter the calculation or do I have to use a querry or so?



Problem 2:
Sheet should be the number of the sheet one line above, so I just have
to change it, when a new sheet is written.
That should be the same problem like question 1 or is this easier?



Problem 3:
In a querry, I've got this:

In (SELECT [Zi1] FROM [Konto] As Tmp GROUP BY [Zi1] HAVING 
Count(*)>1) And Yes

...and I want to change "Zi1" to "Zi2" and "Zi3" or "Zi4" from time to time,
so I wrote a function to return Zi1, ... , Zi4. It's called GetZi() and 
returns Zi1 or Zi2, or ...
BUT: In the querry, I can't write it like this:

In (SELECT [=GetZi()] FROM [Konto] As Tmp GROUP BY [=GetZi()] HAVING 
Count(*)>1) And Yes

...without getting errors. It seems to me that Access dosn't want any
function-calls in a querry.
Is this impossible to do so?



Problem 4:
I've got another endless-form:

[...] some things that doesn't matter here
Sum: cost of a product
Zi1: Yes/No, if the room 1 is concerned
Zi2: Yes/No
Zi3: Yes/No
Zi4: Yes/No

I want to calculate the costs of room 1, 2, 3 or 4 and therefore, I have
to make a querry to get the number of rooms concerned of that line like:
Sum Zi1 Zi2 Zi3 Zi4  -> NrOfYes  -> CostForEachParty
21  Y   Y   N   Y       3           (21/3=) 7
30  N   Y   Y   N       2           (30/2=) 15

How can I do that?




TNX a lot even if you can help me with only ONE of the problems...

PS: German answers are accepted too :-)

PPS: Please reply with EMail too - if it's not a problem.

---
Karl VOIT alias vk@sbox.tu-graz.ac.at                     
         Student @ University of Technology of GRAZ (Austria)     
                                            (No, we have no Kangaroos!)     
Further information on http://www.sbox.tu-graz.ac.at/home/vk/
Re: Q: MISC questions
#42
Author: Bob Gailer
Date: Tue, 28 Oct 1997 00:00
14 lines
1347 bytes
>In (SELECT [=GetZi()] FROM [Konto] As Tmp GROUP BY [=GetZi()] HAVING 
>Count(*)>1) And Yes
>
>...without getting errors. It seems to me that Access dosn't want any
>function-calls in a querry.

Select can be followed by field names or expressions. A function call
is an expression; you should see the value returned by the function in
each row of the result set. What you can't do have a function supply a
field name to the query. So generate the sql this way:

sql = "(SELECT " & =GetZi() & " FROM [Konto] As Tmp GROUP BY " & _
=GetZi() & " HAVING >Count(*)>1) And Yes"
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads