Switch () Function In Access
Thank you for taking the time to report an issue.
What's wrong... Please write below.
The Function works as is, but as soon as I try to add in additional lines (in red), it no longer works for me, here is what it looks like:
Can someone give me some advice on what might be hapenning or a different option that may be better?
. I've attached the DB. The query in question is qryProdSupport1.
SELECT Switch(Habitat=T,"Terrestrial",Habitat=A,"Aquatic" ,Habitat=E,"Epiphytic")
I need to display "Terrestrial" insted of "T" like wise,
DpRpPc: Switch(([DpNeIs]+[DpNeOs])=0,0,[DpNeOS]>0 And [DpNeIS]>0,(([DpNeIs]/2)+[DpNeOs])/[NeDpPts],[DpNeIs]>0 And [DpNeOs]=0,([DpNeIs]/2)/[NeDpPts],[DpNeOs]>0 And [DpNeIs]=0,[DpNeOs]/[NeDpPts])
The problem is if the DpNeIs=0 and DpNeOs=0 instead of displaying 0, it displays #Num
Now I am trying to create a function to take the field Alpha, and create the field SPerson using a function that uses a Case statement.
This is what I have thus far:
Is there a way to do this using by creating a function and using select case? I'm not sure how to reference multiple fields in a table.
Here is an example of what I was originally thinking of...
I am unable to get Microsoft Access Runtime working on the main networking computer (not mine) without the error message (offering switches for Runtime) coming up and then it comes up with a message saying something to the effect of there being an error and the application is closing down. I have used Runtime on several computers with no problem.
What are some of the likely reasons for this message coming up?
Is there a need to choose a switch?
If there is a need to choose a switch, which switch should I choose?
If there is a need to choose a switch, exactly where should I put it?
If there is no need to choose a switch, what should I do to fix the problem
Category = ('Category3') AND PFM 1, (IMUnits*PFM)/(1-PFM),
Category = ('Category3') AND PFM = 1, 0
The idea being that if PFM = 1 it should skip the formula (because 1 - PFM would be 0, causing a division by 0 error) and just use 0 as the value. However, it seems to be ignoring the "AND PFM = 1" part and doing the division anyway because it still returns #ERROR for any row where PFM = 1.
Can I not use AND within a SWITCH condition? How can I make this work? Note thatthis is only part of the SWITCH statement, there are several more conditions that can occur, which is why I want to use SWITCH.
I wrote simple function that calculates difference of two fields:
Public Function oduzimanje(IznosPlaanja As Double, CijenaTe
aja As Double) As Double oduzimanje = (CijenaTe
aja - IznosPlaanja) End Function
In form in which I would like to use this function , I made Text box and in it wrote
=oduzimanje([Iznos plaanja];[Cijena te
And when I switch to Form view in that text box instead of result I get