What is ! Uses for in Access VBA? [duplicate] - ms-access

This question already has answers here:
Bang Notation and Dot Notation in VBA and MS-Access
(3 answers)
Closed 5 months ago.
I'm working with database with criteria code for the posting date: where >=CDate(format([Date Table]![end date])
This is not the exact syntax as im not at work, but does anyone know what the ! Means and what this might be trying gto do? End date is a field in Date Table. Thanks for any help.

"Identifier Operators are the shorthand of object oriented systems. These are the ! and . symbols that you may have seen in macros or queries. These operators show that one element of an expression belongs to another. You use the ! operator (also known as the "bang" operator) when you are referring to an object that you created, such as a field or form. You use the . operator (also known as the "dot" operator) to refer to a control name or something that Microsoft Access created such as a property. Generally, you'd like to use a . over ! because a . provides compile time validation which can catch typos and invalid references. The bang operator ! is only evaluated when the code is executed and would cause a runtime error."
For your specific case, it is used to refer to the [end date] control on your [Date Table] form. Or more simply-- shorthand for
[Date Table].Controls("[end date]")

Related

what countrows().equals() means in SSRS

I can't understand the structure of the written code
(CountRows("client_code").Equals(Parameters!client_code.Count)
can anyone explain this please?
And where can I find a reference for all the functions that I can use to write Expression in SSRS??
In SSRS we use "=" operator for comparison rather than equals.
Expression mentioned by you below
(CountRows("client_code").Equals(Parameters!client_code.Count)
Rather it should be like
=IIF(CountRows("client_code")=Parameters!client_code.Count,true,false)
What your mentioned code does: It Returns a count of rows within the specified scope, Scope can be Group as well. and it compared with your Report Parameter count.
Here you will find complete list of functions and expression for SSRS.

expression in split component in SSIS giving error

I am trying to implement conditional split component in my SSIS package. I need to split the records based on the year. I need to extract data for the last 5 years and need to split it before i dump it to the destination
periodenddate is datetime field. I need to extract the year part from that field and compare it against the actual year as mentioned in the expression. I am getting an error for invalid expression. Could somebody tell me where am i going wrong
The expression i am using is for eg
periodEndDate == YEAR(GETDATE())
Please find the error attached
Second error
Third error
If you want the year number from one year ago, you need to use:
YEAR([periodenddate]) = YEAR(GETDATE()) - 1
YEAR([periodenddate]) = YEAR(GETDATE()) - 2
etc.
Having the "-1" inside the parentheses for the Year() function will give you the wrong answer at the very least.
Note that you got different errors with each version of your code:
The first image shows a failure to find a field due to SSIS being case sensitive
The second image shows a failure due to comparing a datetimestamp to an integer
The third image shows an error with the expression "GETDATE() - 1", which is on a different conditional expression component than the first two images.

Change Case in SSRS 2013

I am using a parameter to change the background color of my field when the field string contains the parameter string .
I have used IndexOf, Contains, and instr. All three work, however they are all case sensitive. (i.e. when I search 'Dol' Dollar Tree and Doldrum are highlighted but not Sandolski etc.)
It is not the stored procedure, the correct records display, however the SSRS functions are what is my challenge.
I have tried toLowerInvariant but was receiving an error Help please.
As I was writing this I checked my error and learned the issue..
I assumed the syntax was to pass my string as a parameter:
toLowerInvariant(Parameters!Param1.Value)
However the correct toLowerInvariant syntax is (in ssrs):
Parameters!Param1.Value.toLowerInvariant()
An explaination on toLowerInvariant can be found here: string.ToLower() and string.ToLowerInvariant()
And also I have found that this comparison is best done with a Switch (if you are comparing multiple parameters to the field).
I have not noticed a performance impact between Field.IndexOf(#Param), Field.Contains(#Param), or Field.Instr(#Param)
My final code:
=switch(
instr(Fields!Client.Value.toLowerInvariant(),Parameters!Client_Firm.Value.toLowerInvariant()) >= 1, "Cornsilk",
instr(Fields!Client.Value.toLowerInvariant(),Parameters!KeyWord.Value.toLowerInvariant()) >= 1, "Cornsilk"
)

Symbol required to enter date in text strings

I am working on a homework assignment for school, and I have come across one particular question which has me a little stumped. The question is, 11. What symbol does Access SQL require to enter dates in text strings? I have found the use of ''(single quotes), " " (double quotes), and #(pound sign), but I have not been able to find a definitive answer to this particular questions. Which would be the correct answer?
Since this is homework, I'll show you how to find the answer you need.
Open the Immediate window (Ctrl+g) and run both of these statements (pressing Enter after each):
Debug.Print TypeName("5/2/2013")
Debug.Print TypeName(#5/2/2013#)
However it's safer to use yyyy/m/d format with literal date values to avoid locale issues ... ie does 5/2/2013 represent May 2nd or Feb 5th?
Debug.Print TypeName("2013/5/2")
Debug.Print TypeName(#2013/5/2#)

Multiple IF statement in SSRS

How to write multiple if statement in SSRS. I have written like this.
=IIf(Parameters!MyDuration.Value="ThisMonth" & Parameters!Transactions.Value="Sale", Sum(Fields!ThisMonthSal), True,False)
this is throwing an exception that multiple parameter used. Please guide me how to write this multiple if statement.
The & operator concatenates two strings. You're looking for the And operator. Refer to this msdn article.
In addition, note that IIF has three parts (see decision functions here), and works like this:
=Iif(test, truepart, falsepart)
I'm not sure what you're trying to do with the "SUM" bit (or what you're trying to achieve at all, the question's not clear on that), but something like this would work:
=IIf(Parameters!MyDuration.Value="ThisMonth" And Parameters!Transactions.Value="Sale",
Iif(Sum(Fields!ThisMonthSal.Value) = 0, "Zero sum", "Non-zero sum"),
"Not thismonth or sale")
Finally, you're not entirely clear about the error you're getting. If you're also having a problem with accessing the parameter you may have to investigate that seperately. In any case, the above should explain the Iif bit.