Trying to replace a certain character in SSRS - reporting-services

I am trying to replace a the charater 0 when pulling through a report. I have entered the expression below and when I run my report I get a #Error any hints on what I am doing wrong?
Thanks
=IIf(Fields!HomeAddress2.Value & " " & Fields!HomeAddress3.Value & " " &Fields!HomeAddress4.Value = 0, Fields!HomeAddress2.Value & " " & Fields!HomeAddress3.Value & " " &Fields!HomeAddress4.Value, "")

Isn't it similar to NULL?
Maybe you can try ISNULL( <your expression>, " ")

Related

Is possible to concatenate multible fields with one that is a conditional iif statement

I'm working on an ssrs report using Report builder 2008, currently trying to concatenate using something like this but when I do so, I receive an error for the field 'lifeamount' specifying that the expression can only refer to fields within the current dataset scope. I've tried different ways to specify the dataset which is the same for all the fields but to no avail. Is this even possible?
=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " & rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " & rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " & IIF((Fields!Lifeamount.Value)> 100000.00, 100000.00, Fields!lifeamount.value, "EmployeeInfo"))
SSRS expressions are case sensitive which means that your second lifeamount reference is more than likely wrong.
Try this instead:
=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " &
rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " &
rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " &
IIF((Fields!Lifeamount.Value)> 100000.00, 100000.00, Fields!Lifeamount.value, "EmployeeInfo"))
If the expression is located in a cell that is within the same scope as the details you are fetching (i.e. "EmployeeInfo") then I don't think you need to specify it at all.
Also there are some brackets out of place I think. I can't test it at the moment but try this...
=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " &
rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " &
rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " &
IIF((Fields!Lifeamount.Value, "EmployeeInfo")> 100000.00, 100000.00, (Fields!Lifeamount.value, "EmployeeInfo"))

SSRS expression not displaying the right values

I'm trying to run the following expression:
=IIF((Fields!EntryFirstName.Value = " ") And (Fields!EntryLastName.Value = " " ),
"Team:" & Fields!TeamName.Value, Fields!EntryOrder.Value & " . "
& Fields!EntryFirstName.Value & " " & Fields!EntryLastName.Value)
The table that the following is looking at is this one :
However running the above expression will only return the following ( where EntryFirst name is the column EntryfirstName and so on):
Fields!EntryOrder.Value & " . "
& Fields!EntryFirstName.Value & " " & Fields!EntryLastName.Value
for the whole report ( this one expression is part of a row group, if that would change anything)

Need to format code for querying with exact value from combo box

I have the following ms access query. I want it to query with the gender (female or male) selected from the combo box. At the moment, when I select "female", the query results also includes all male persons.
How should I format this code:
WHERE (((Q_Gender_Statistics.Year) Like [cboYear] & "*") AND ((Q_Gender_Statistics.Gender) Like "*" & [cboGender] & "*"))
Don't use Like if not needed:
" WHERE Q_Gender_Statistics.Year = " & [cboYear] & " AND Q_Gender_Statistics.Gender = '" & [cboGender] & "'"
If cboGender looks up "Male/Female" form an index value, try this:
" WHERE Q_Gender_Statistics.Year = " & [cboYear] & " AND Q_Gender_Statistics.Gender = " & [cboGender] & ""

syntax error at insert into

i need to insert some informations from a form to a table fields, i tried this code:
Dim sql As String
sql = " insert into récapRELAIS( Région, Groupe, Agence, N°personne,
Nom du client, N°prêt, Durée, Nature du prêt, Encours client)
Values ("
& Me.Region & " , " & Me.Groupe & " , "
& Me.Agence & " , " & Me.Num_Personne & " , "
& Me.Nom_client & " , " & Me.Num_Contrat & " , "
& Me.Montant_prêt & ", " & Me.Durée_prêt & " ,"
& Me.Nature_prêt & " , " & Me.Encours & "); "
DoCmd.RunSQL sql
but it doesn't work, it says that i have an error type 3134
The problem are most likely your field names with spaces.
Solution: Surround with square brackets - [ ], like this:
insert into récapRELAIS( Région, Groupe, Agence, [N°personne],
[Nom du client], [N°prêt], Durée, [Nature du prêt], [Encours client])
I am also not sure if the ° sign is working.
In general, I advice you to not take spaces or special characters or diacritics like ê è é for database field names.
Formatting and pretty display should take place in the user interface; but the database is more a programming environment, and there, it's better to just use the basic characters A-Z and 0-9.

Using DCount function with a query linked to a control

The following code is giving me a syntax error message. I would like to use the DCount function on the current event of a form to count records in a table where the value on the control 'TeamID' is equal to that in field 'teamID' in the table 'tblCompetency06'
Me.etcRecordNumber.Caption = "Record " & Me.CurrentRecord & " of " & DCount("ID", "tblCompetency06") WHERE [tblcompetency06].[teamID]= '" & me.Teamid & "'"
There could be two reasons, one you are using the wrong syntax for DCount. Second you are using/comparing a Number data type and you are comparing with a String. Try the following.
Me.etcRecordNumber.Caption = "Record " & Me.CurrentRecord & " of " & _
DCount("*", "tblCompetency06", "[teamID]= " & me.Teamid)