Owner: IIf(isNull([Company]),[OwnerFirst] & ", " [OwnerLast],[Company])
You may have entered an invalid identifier or typed parenthesis following the Null constant
You need another ampersand operator before [OwnerLast]. Try-
=IIF(IsNull([Company]),[OwnerFirst] & ", " & [OwnerLast],[Company])
Related
I have .setFormula() and stuck on this. I think the problem is the comma (&","). I have researched several online forum before posting this question but no luck; perhaps someone here could help me out. I do know the rules about using the "" and '' that's why I have tried several formulas but still, I receive the error message:
"Missing ) after argument list".
Your time and help is appreciated!
Original formula:
=arrayformula(concatenate(filter('Sheet1'!E2:E,'Sheet1'!E2:E<>"")&", "))
code:
me.getRange('B8').setFormula("=arrayformula(concatenate(filter('Sheet1'!E2:E,'Sheet1'!E2:E<>"") & ", "))");
Formulas I have tried but failed:
"=arrayformula(concatenate(filter('Sheet1'!E2:E,'Sheet1'!E2:E<>'') & ', '))");
'=arrayformula(concatenate(filter('Sheet1'!E2:E,'Sheet1'!E2:E<>'') & ', '))');
"=arrayformula(concatenate(filter('Sheet1'!E2:E,'Sheet1'!E2:E<>'') & ", "))");
'=arrayformula(concatenate(filter("Sheet1"!E2:E,"Sheet1"!E2:E<>"") & ", "))');
You dont need single quotes ' around Sheet1.
Try
me.getRange('B8')
.setFormula('=arrayformula(concatenate(filter(Sheet1!E2:E,Sheet1!E2:E<>"") & ", "))"');
If you still need it, you need to escape it with backlashes like this \':
me.getRange('B8')
.setFormula('=arrayformula(concatenate(filter(\'Sheet1\'!E2:E,\'Sheet1\'!E2:E<>"") & ", "))"');
Reference:
String § Escape notation
In my project I am using dsum to query a table to compare years. But I want to render the field as a year for the comparison.
Public Function GetValue(whatyear) As Long
GetValue = DSum("Modification", "Accounting Totals", "Format([EntryDate],'yyyy') = " & whatyear & " AND [ModType] like *2*")
End Function
I keep getting this error:
Syntax error (missing opeator in query expression
'Format([EntryDate],'yyyy' = 2016 AND [ModType] like *2*"
This is probably an easy one for you VBA Gurus. What do I do?
you need qoutes for the year, and if [ModType] is text, you need qoutes for it as well. in addition, handle null values like this, else if it doesn't find any rows, that will throw another error:
Nz(DSum("Modification", "Accounting Totals", "Format([EntryDate],'yyyy') = '" & whatyear & "' AND [ModType] like '*2*' "), 0)
if [ModType] is a numeric value, then the like operator is not going to work, you need to use another operator such as these: =, >=, <=, BETWEEN
Got it - I had to remove the As Long from the function declaration
If so, you may have zero records and DSum returns Null. Catch that - as O. Gungor showed - with Nz. And get the year as a number:
So:
Public Function GetValue(ByVal whatyear As Integer) As Currency
GetValue = Nz(DSum("Modification", "Accounting Totals", "Year([EntryDate]) = " & whatyear & " AND [ModType] Like '*2*'"), 0)
End Function
I wanted to convert DDMMYYYY formated data (data type is varchar) to MM-dd-yyyy format using SSRS expression only.
I tried the following but it is showing #Error
=IIF(NOT(IsNothing(Fields!DoB.Value)),CDate(Fields!DoB.Value).ToString("MM-dd-yyyy"),Nothing)
=IIF(NOT(IsNothing(Fields!DoB.Value)),Format(CDate(Fields!DoB.Value),"MM-dd-yyyy"),Nothing)
It I try like below then it shows MM-dd-yyyy,
=Format(Fields!DoB.Value, "MM-dd-yyyy")
I don't understand why you pass it as a string in your report. Anyway here it is.
I tested it using this expression:
= Mid("25052016",3,2) + "-" + Left("25052016",2) + "-" + Right("25052016", 4)
and this is my output:
05-25-2016
Basically what I did here is just separate your string in three chunks separated with - to achieve your goal.
So in your example expression you could try it like this:
=IIF(NOT(IsNothing(Fields!DoB.Value)),(Mid(Fields!DoB.Value,3,2) + "-" + Left(Fields!DoB.Value,2) + "-" + Right(Fields!DoB.Value, 4)),Nothing)
Note: I'm not 100% sure that the expression just above this comment will work in your end because I haven't tested it but atleast I showed to you my concept on my other example.
Have you tried to parse the field value, like this?
=Format(CDate(Mid(Fields!DoB.Value,3,2) & "-" & Left(Fields!DoB.Value,2) & "-" & Right(Fields!DoB.Value,4)), "MM-dd-yyyy")
I am trying to concatenate a number with a symbol in an MS Access textbox.
The field is a number (ie 44), and a symbol (ie °).
I have tried several different ways:
=[myNumber] & " °"
gives a #Type error
=myNumber & " °"
also results in a #Type error
=[myNumber] & [°]
results in a #Name error
=[myNumber] & " °"
works for me in Access 2010.
You can try to explicitely convert it into a string (and check for NULL, because CStr() doesn't like NULL):
=CStr(Nz([myNumber], "")) & " °"
As the question says, I get this error whenever I try to run my query.
I have 3 fields I want to search in each table, an OEM code, models and additional search terms.
Here is the SQL:
PARAMETERS [Search] Text ( 255 );
SELECT *
FROM inkSearch
WHERE inkSearch.[OEMCode] & inkSearch.[printers] & inkSearch.[ast] LIKE "*" & [Search] & "*"
UNION SELECT *
FROM tonerSearch
WHERE tonerSearch.[OEM Code] & tonerSearch.[Models] & tonerSearch.[Additional Search Terms] LIKE "*" & [Search] & "*";
The error goes away if I remove the LASERS.[Models] field, however this is no different to the inks printers field and I can see no reason this is giving me problems.
I have changed the query to this which seems to work. I had initially based it off two queries that narrowed down the fields.
I also discovered that the Models field was text on the toner table and memo on the inks which may have caused it.
The below query appears to have fixed this issue:
PARAMETERS [Search] Text ( 255 );
SELECT LASERS.[OEM], LASERS.[T1inclSell], LASERS.[Yield], LASERS.[Models], LASERS.[AST]
FROM LASERS
WHERE (LASERS.[OEM] & LASERS.[Models] & LASERS.[AST]) Like "*" & [Search] & "*"
UNION ALL SELECT INKS.[OEM], INKS.[T1inclSell], INKS.[Yield], INKS.[Models], INKS.[AST]
FROM INKS
WHERE (INKS.[OEM] & INKS.[Models] & INKS.[AST]) Like "*" & [Search] & "*";