Why do I have this error : Error BC305016 - vba

I'm working on a report on microsoft report builder and on one of the textbox I have this formula
=iif(Parameters!DescritpionOnOff.Value=0,
(iif(Parameters!Model.Value not like "",
"On " + Join(Parameters!Model.Value, ", ") + " version",
""
)),
(iif(Parameters!DescriptionBody.Value "",
Fields!Descritpion.Value,
Parameters!DescriptionBody.Value
))
)
When I launch the report I have the error
The Value expression for the textrun ‘Textbox1082.Paragraphs[0].TextRuns[0]’ contains an error: [BC30516] Overload resolution failed because no accessible 'IIf' accepts this number of arguments.
I tried to rewrite it, change the brackets but nothing work.
Can someone explain me why this does not work ?
Making a dynamic value based on a filed that let you choose or not if a there is a text, and if this parameter is not activated, there is text that appear in the place of it

Related

Getting an error with filtering property in Get outlook Mail Message

I am getting this error message in a UIPath statement:
Get Outlook Mail Messages: Cannot parse condition. Error at "#SQL=(("http://schemas.microsoft.com/map...".
This is my code:
"#SQL=""http://schemas.microsoft.com/mapi/proptag/0x0037001f"" like '%asean prs%' AND [Received] >= '" + DateTime.Today.ToString("d") + " 00:00AM'"
How can I fix this?
I dont think a string can be "bigger than or equal to" (>=) another string. It can either be equal (=) or not equal (<>). The length of the string can be greater, but not the string itself.
Also, there might be something wrong with your use of apostrophies, single and double quote marks.

VBA Runtime Error 13 because of wrong Format

I want to add a product number to a collection like this:
colData.Add marke.Value + " " + pn.Value (Range-Objekte)
Every time I start the macro it runs in Runtime Error 13.
If the product number is like 256-78979-0980 everything runs fine.
If the product number is like 8898686 the error occurs.
Writing CStr(pn.Value) doesn't solve the issue.
The only solution I found is to change the format of all PNs to type text.
Then I need to go in the cell and press "Enter" after that a sign appears on the cell stating that the number is recognized as text.
After that the macro works fine for this cell but not for the others.
How can I change my data to make it work with my macro?
Avoid using + for concatenation.
Try repalcing of
colData.Add marke.Value + " " + pn.Value
with
colData.Add marke.Value & " " & pn.Value

Reading a line from the clipboard in vb.net not matching text

I am trying to read from the clipboard and place in an array. I want to validate the first line as the text: "Client Code "
I fill the array with:
tbClipBoardContents.Text = My.Computer.Clipboard.GetText()
For Each strLine As String In tbClipBoardContents.Lines
arrClipBoard.Add(strLine.ToString)
Next
When I give a variable the value of the first array entry it appears correct = "Client Code " in Visual Studio debugging.
Dim test As String = Trim(arrClipBoard(0).ToString)
However when I check using the "IF" statement it tells me it is not correct??
If test = "Client Code " Then
MsgBox("Correct Clipboard Structure")
Else
MsgBox("Not a Valid Clipboard Structure: " & Trim(arrClipBoard(0).ToString)) ' ** Fires this response.
End If
What is doing my head in is that if I copy the value of test from VS debugger and paste it in the if statement it looks like "Client Code " but this time the if statement fires the correct response.
I have tried it by filling the textbox (tbClipBoardContents) using:
tbClipBoardContents.text.split(New [Char]() {CChar(vbCrLf)})
and
tbClipBoardContents.text.split(newvbline)
with the same results.
So does this mean the true value from the clipboard for the line "Client Code " also carries some hidden characters? Any help is appreciated.
Brad
P.S. I have found that if I test the value of Mid(test,1,11) then I will get the desired result, so this is a workaround but would be interested to know what the 12th character is? Perhaps it is the "CChar(vbCrLf)"
As per my observation Trim will have removed the spaces. and you should change the condition to "ClientCode".
The final solution that worked for me was to find the trailing space using Andrew Morton's method above then
arrClipBoard.Add(Trim(Regex.Replace(strLine.ToString, Convert.ToChar(160), "")))
which effectively converted the char(160) to "".

MS Access VBA Dlookup on Yes/No field

I can't for the life of me work out what is wrong with this, but I'm not an Access/VBA developer normally..
I have a database table with about 20 fields, one of which is a Yes/No field. I want to extract the Yes/No value using DLookup, however am receiving the following error:
Run-time error '3075':
Syntax error (missing operator) in query expression 'Enabled'.
The code I am using it:
MsgBox (DLookup("Enabled", "Numbers", "ID = " & Me.cbxNumber.Value & ""))
Enabled is a Yes/No field
ID is a String field.
The above DLookup works absolutely fine for returning String values for other fields, so the last parameter with the search query, and the table field, should be fine. It is simply complaining about the return field ('Enabled') thinking it is a query.
The MsgBox element is also irrelevant, as I have tried assigning the result to an Integer and to a Boolean, and it's not complaining of a type mismatch which I would expect if this were the problematic part.
Any thoughts?
You stated that ID is a string field. If that is the case, try changing the DLookup to...
DLookup("[Enabled]", "Numbers", "ID = " & Chr(34) & Me.cbxNumber.Value & Chr(34))
If ID is a Long, then use this string...
DLookup("[Enabled]", "Numbers", "ID = " & Me.cbxNumber.Value)
Your code works fine for me:
Table:
Form:
Code:
Private Sub Command30_Click()
MsgBox (DLookup("Enabled", "Numbers", "ID = " & Me.cbxNumber.Value & ""))
End Sub
The messagebox displays 0 or -1 as required. Things to check:
Is your code in the forms module? Otherwise Me.cbxNumber.Value won't return anything.
What do you get if you run
debug.print Me.cbxNumber
from the OnClick of a button on the form?

Syntax error in VBA query expression in Access - Stumped

I'm getting a message that there is a syntax error in a VBA query expression I have on a button in Access. Unfortunately, I just cannot figure out what the syntax error is. I'm pretty sure I'm using everything correctly. I'm sending this expression as the WHERE clause to a report being generated. The screenshot is below. Can anyone help?
The two strings that read "tk" are put into the expression from a couple input boxes.
My expression in text:
cond = "(((StrComp(""" & lower & """,Left([Location],2)))<=0) And ((StrComp(""" & upper & """,Left([Location],2)))>=0));"
stDocName = "rptMstrEquipListRange"
DoCmd.OpenReport stDocName, acPreview, , cond
According to www.balancebraces.com, the parentheses aren't the problem:
It should work fine if you remove the ; at the end. (Tested)