I have a calculated field on a table at MS Access and I'd like to use the following syntax, but it returns a syntax error pop-up and and I'm wondering which part is wrong. Could you please help with this? Thanks a lot.
IIf([Letter_Grade]="A+",4,IIf([Letter_Grade]="A",4,IIf([Letter_Grade]="A",3.7,IIf([Letter_Grade]="B+",3.3,IIf([Letter_Grade]="B",3,IIf([Letter_Grade]="B",2.7,IIf([Letter_Grade]="C+",2.3,IIf([Letter_Grade]="C",2,IIf([Letter_Grade]="C",1.7,IIf([Letter_Grade]="D+",1.3,IIf([Letter_Grade]="D",1,IIf([Letter_Grade]="D-",0.7,IIf([Letter_Grade]="F",0)))))))))))))
Try adding ",null" after your last expression:
IIf([Letter_Grade]="F",0,null)))))))))))))
Though it may be better to use a query?
The function works well, did you put = operator before it.
Attached are some images of the results I got and the function
Related
I'm beginner in MySQL and I want to make a request to find all tables with this word "Ostéotomie", it works only if I write "%Ost%" and not "%Ostéotomie%"
The fact is that it shows me only 4 results instead of the 9 I need.
Here is a SQL Fiddle to show what I mean : SQL Fiddle
The table wasn't created by me, I'm working on a search bar from a project which isn't mine.
I don't know if you can help me, if I've putted enough information.
Thanks in advance.
I tried replacing é with % and the query gave me expected results.
https://dev.mysql.com/doc/refman/8.0/en/charset-binary-collations.html
Maybe this solved your Problem.
I have a curious question that's going on my mind while looking at my datatables.
I noticed that some columns of my table has no values, like just the column only.
Is it possible when you want to call that column it will return a value of 0?
I tried to call it with a simple SELECT query in sql but its giving me a notice.
Notice: Trying to get property of non-object MySQL result on line (number line)
Can this be used with an if-else statement from the query or a case statement from the query? Hoping for your opinions on this. Thank you :)
Try to use some function like NVL() in Oracle, or IFNULL() in MySQL. This functions set a value when you got a NULL value.
Is there any function like IFERROR in MySQL. For example:
IFERROR(25/0,9)
I tried on phpmyadmin but it said that such function IFERROR does not exist. Really appreciate any help
YOu can reach similar results with IFNULL:
If an answer is not valid, it defaults to NULL. The IFNULL will then give you the alternative answer:
Your example (in this case):
SELECT IFNULL(25/0,9);
Gives as result: 9
According to MSDN the syntax to convert a number to decimal in VBA is
CDec(expression)
I often use conversion function in access SQL as well. eg Clng, Cint etc...
However when I use CDec I sometime get this error
Compile error:Wrong number of arguments or invalid property assignment
Consider:
In the immediate window
? cdec(round(0.00023,4))
0.0002
? CDec(Round(0.12345678+0.00000001,6))
0.123457
? CDec(Round(0.12345679,6))
0.123457
? CDec(Round(0.12345679,6),10)
This gives the above error (ie as expected as no parameter is allowed)
In a SQL query column
CDec(Round(0.12345678,6))
This gives the above error.
CDec(Round(0.12345678,6),2)
This WORKS and give the answer 0. What does the parameter do!?
CDec(Round(0.12345678,6),2,1)
This gives the above error.
I guess when a function is called from access SQL it is using different code to the one used by VBA. However, I'm stuck and don't understand.
Help!
I'm using MS Access 2013: Build: 15.0.4727.1003 32bit
Harvey
Dennis Wilmar of MS tells, that this is a confirmed bug from Access 2003 - not up to be removed:
Error message when you use the CDec() function in an Access query
The suggested work-around is to wrap CDec in a custom function:
Function NewCDec(MyVal)
NewCDec = CDec(MyVal)
End Function
I'm a noob with sql and trying to figure my way through zencart. There's a bit in the code where it prepares a SELECT statement and amongst that there is the following line:
AND cd.language_id = :languagesID
I can't figure out what the : does. I thought maybe it refers to a $variable like $languagesID but I can't find that variable anywhere either.
What does the : do? Google left me none the wiser.
It's for prepared SQL statements. It's replaced later on with an actual value. Google "Prepared SQL"