Why control is not going inside the if () , still the condition is satisfied? - vba

Condition is satisfied but still the control is not going inside the IF().
c has "To be uploaded" & equal the value through I am comparing but control is not going inside. Am I using any wrong syntax , but it's working well for some other files.

If you have a look at the tooltip, there appears to be at least one space following the text:
Hence it will not be equal to a string holding the text without a space.
If you want it to catch strings with spaces on the end, I suggest you use rtrim() or even trim() if you want leading spaces ignored as well.
You could also use lcase() to ignore any issues with upper and lower case as well. Putting both those into effect would be something like:
If LCase(Trim(c)) = "to be uploaded" Or LCase(Trim(c)) = "to be loaded" Then ...

try
IF LCase(Trim(c)) = "to be uploaded" THEN
...
END IF

Related

vba inputBox: Alternative Solutions on “cancel” and “OK” with an empty textbox

For some reason, the solution those two questions (Q1, Q2) give on how to differentiate between "cancel" and "ok with an empty string" for an inputbox don't always work within a specific code of mine. I wasn't able to reproduce the problem so far so I'm looking for a different solution.
In my scenario, the inputbox pops up with a default value it got from somewhere else. So far I only needed to change this value through the inputbox so the simple check for if len(inputboxString) = 0 then to determine if cancel was pressed was working well. Now I got the case where I need to "clear" the existing default value. I'm trying to avoid using StrPtr for the reason I described above.
Here's the code that worked so far (as long as I don't need to use the inputbox to delete the value, since 'strInputBox = ""' is reserved for the cancel-event and I want to avoid using 'strPtr').
Dim strSomeStringFromSomewhere as String
strSomeStringFromSomewhere = someSubThatGetsTheStringValueFromSomeWhere
Dim strInputBox As String
strInputBox = InputBox(Prompt:="Edit/Delete Value", Title:="Title", Default:=strSomeStringFromSomewhere)
If strInputBox = "" then
'do nothing cause cancel was pressed
else
someSubThatWritesTheChangedStringBackToItsOrigin strInputBox
End If
The used value is usually some alphanumeric string e.g. d939d8ej3.
Any hints/ideas for a different user friendly approach would be welcome. (user meaning the person using the inputbox not the person who implements/maintains the code).
I figured out a nice work around, which should work in many other cases as well. In my case a single or multiple spaces are not a valid entries. And since I have to get rid of pre- and succeeding spaces anyway I just use trim(strInputBox) which will "clear" my value.
So the user just has to enter a space into the inputbox, which is good enough for prototypes.

IntelliJ IDEA & AppCode live template nested variable issue

I have this snippet that are used in textmate:
var ${0:name} = ${1:"${2:value}"};
When this snippet get called, first the name will be selected and I have a chance to type something and change the variable name. Press TAB again it will select "value", in this case if my value is a number (the quotes is not required) I can start to type a number and overwrite "name". If my value is a string, I can press TAB again and it will select name (no quotes), I can actually type something and they will appear in the quotes. I want to know if this is doable in JetBrains software like Intellij IDEA and AppCode. I've tried but failed. Below is my code for JetBrains software.
var $name$ = "$value$";
I don't know how to give me a chance to select "value" instead of directly selecting value. Anyone can point me to the right direction? Thanks.
I don't think you can do exactly what you want. I got fairly close using this template:
var $name$ = $QUOTE$ $value$ $QUOTE$;
Then in "Edit variables" I set the expression for QUOTE to be "\"" and moved value above QUOTE.
This allows you to type the name, as you wanted, and tab next to value, where you can enter a string or a number. The next tab will highlight the first quote, which you can delete if you had a number - this will also delete the trailing quote.
However this is not exactly what you wanted, as the value inside the quotes, should you leave them there, has spaces either side. This is because what I really wanted was
var $name$ = $QUOTE$$value$$QUOTE$;
but if you put two variables next to each other like this, IntelliJ gets very confused.
I know this isn't the answer, but maybe it has you thinking about slightly different approaches to the problem.

how can I disable rows in my gridview with datasource rowfilter?

How can I hide rows in my Gridview with a specific value? For example I want to hide all rows with column("dubletten_Vorschlaege") is empty
skmTabelle.SLXADRIUMDEVDataSet.Tables("SKM2").DefaultView.RowFilter = "Dubletten_Vorschlaege =Nothing"
said he cant find the column nothing?
skmTabelle.SLXADRIUMDEVDataSet.Tables("SKM2").DefaultView.RowFilter = "Dubletten_Vorschlaege ="""
said he cannot read the statement at """
I've never used rowfilter so I hope someone can explain.
Edit:
thx levi, it doesn't throw an exception now. But the gridview doesn't change. how do I do that? Do I need to use the fill query again?
on the formload event I have
Me.SKM2TableAdapter.Fillg(Me.SLXADRIUMDEVDataSet.SKM2, Module1.pkey)
which only selects the rows which are new.
for example I imported new 2000 rows it only shows them.
Do I need to use this statement again?
I would refer you to this site for a few tips on using rowfilter.
http://www.csharp-examples.net/dataview-rowfilter/
In your case, I think the proper way may be to write the string like this. I have followed a similar approach and this worked.
...DefaultView.RowFilter = "Dubletten_Vorschlaege ='" & "'"
you will notice that i add a single quote after the = and again add a single quote within double quotes after the &.
Also, I refer you to this StackOverflow link
How do I check for blank in DataView.RowFilter
The user simply added the line of code as this:
...DefaultView.RowFilter = "Dubletten_Vorschlaege = ''"
notice the two single qoutes before the ending double quote.

SSRS expression and free text in the same textbox

Is it possible?
I would like to place the following inside a textbox:
There are =Count("MyDataSet") records found.
But if I place that in the expression on the textbox it just displays as above instead of getting the value.
Now I know if I were to split the above in two different textbox works ok but for spacing reasons it would be better if I could just use one?
Is that possible?
You need an expression in the textbox that specifies the text strings and concatenates these to your count value, something like:
="There are " & CountRows("MyDataSet") & " records found"

How to ignore blank criteria in queries in Access

I'm currently working with an update query, that works as expected until I add in criteria that makes the query not display any results (which I expected). The criteria is currently coming from textboxes on a form.
What I want to be able to do is, in the criteria line, specify that if the the textbox is blank with nothing in it, then the criteria should just skip that.
I've tried in the Criteria line:
[Forms]![Formname].[txtboxName] OR [Forms]![Formname].[txtboxName] Is Null
but that doesnt work.
Thank you for any help or guidance!
You should be able to use a wildcard:
Like [Forms]![Formname].[txtboxName] & "*"
How about:
where [whatever your field is] = [Forms]![Formname].[txtboxName]
OR Nz([Forms]![Formname].[txtboxName]) = ""
The use of Nz will catch both null values and zero length strings, which look null but are not.
If that doesn't work, please do as Remou requested. I.E. Update your question with the actual SQL query instead of just part of it.
try this:
Like IIF(IsNull([Forms]![Formname].[txtboxName])=Fasle;[Forms]![Formname].[txtboxName];"*")
*Note: my system default separator is ";", make sure what yours.
Enjoy the Ride