How to give expression for a textbox when multiple fields are used in the textbox of rdlc? - rdlc

Need to display [Feature] - [FeatureStatus] - [FeaturePerComplete]% if feature field has value or else need to display N/A, what expreession do I need to give for this

Try changing
=IIf(Fields!Feature.Value Is Nothing, "N/A",Fields!Feature.Value & " - " & Fields!FeatureStatus.Value & " - " & Fields!FeaturePerComplete.Value & "%")
to..
=IIf(Isnothing(Fields!Feature.Value), "N/A",Fields!Feature.Value & " - " & Fields!FeatureStatus.Value & " - " & Fields!FeaturePerComplete.Value & "%")
This relies on the Feature column being null in those circumstances - will it definitely be null, or will it be blank?

Related

display table data in a list box (access form)

I want display table data in a list box with this code:
Me.List_history.RowSource = "SELECT Date " & _
"FROM Leaves " & _
"WHERE CodePersonali = " & Nz(Me.CodePersonali.Value)
but the list box doesn't display anything
List_history = my list box name
Date = field name in leave table
Date is a reserved word (it's a function), so you shouldn't use it as column name. If you must, put it between square brackets [Date].
If CodePersonali is a text column, you need to put the value between ''.
That would be
Me.List_history.RowSource = "SELECT [Date] " & _
"FROM Leaves " & _
"WHERE CodePersonali = '" & Nz(Me.CodePersonali.Value) & "'"

SQL Statement in Access

Ive been trying to get a query I ran in Access to run in VBA but I keep getting errors due to the number of exclamation marks I've been using. The statement I am using is
SQLstat = "SELECT tbl_Date_Check.DateofChecklist, tbl_Tasks.QuestionNumber,tbl_Tasks.Frequency, tbl_Tasks.Questions " _
& "FROM tbl_Tasks, tbl_Date_Check " _
& "WHERE (((tbl_Date_Check.DateofChecklist)=""" & [Forms]![Daily_Checker]![TxtDate] & """) And ((tbl_Tasks.Frequency) = """ & [Forms]![Daily_Checker]![ComFreq]"""))"
Any help would be great thanks
This can possibly be explained by the following SO question: What is the difference between single and double quotes in SQL?
This explains that you need to utilize single quotes '' to surround text in SQL in almost every instance. The fact that you are using double quotes "" may be what is causing the error.
I hope this helps.
-C§
It must read like this for dates:
SQLstat = "SELECT tbl_Date_Check.DateofChecklist, tbl_Tasks.QuestionNumber,tbl_Tasks.Frequency, tbl_Tasks.Questions " _
& "FROM tbl_Tasks, tbl_Date_Check " _
& "WHERE ((tbl_Date_Check.DateofChecklist = #" & Format([Forms]![Daily_Checker]![TxtDate], "yyyy\/mm\/dd") & "#) And (tbl_Tasks.Frequency = " & [Forms]![Daily_Checker]![ComFreq] & "))"

number of query values and destination fields not the same

hello I'm looking to just do a simple reason for what this is not working ... i have tried adding the same column twice, taking out the TextBox2 i just cant get it to work. all that works is if i take the last value out and the last column otherwise it will not work at all and i have now idea why.what i want is it to place a check mark in there to along with the name.
code:
Dim SqlText As String = "INSERT INTO tblEmployeeNames ([EmployeeName],
[UseForDropDown]) VALUES ('" & Trim(TextBox1.Text) & " " &
Trim(TextBox2.Text) & " " & (CheckBox1.Checked) & "')"
You have included the checkbox-state with the first value, you need to separate them with a comma.
Dim SqlText As String = "INSERT INTO tblEmployeeNames ([EmployeeName], [UseForDropDown]) VALUES ('" & Trim(TextBox1.Text) & " " & Trim(TextBox2.Text) & "', " & (CheckBox1.Checked))"
Notice the Checked state doesn't require apostrophes around it.
See SLaks comment as well, you should be using parameterized queries.

How to round the floating piont values of textbox in vb.net

I have textboxes on my form using for txtDueAmount, txtPaidamount, txtDiscount and txtNetBalance. Every time I want that as I press the save button so all the floating point values of textboxes turns into integer and if any value is like 30.5 so it also converters it into 31.
This is my insert query:
Insert("SaleMaster", "SaleID, SaleTotalAmount, SalePaidAmount, SaleDiscount,
SaleNetBalance, SaleDate", txtSaleID.Text & ", " & txtSaleDueAmount.Text &
", " & txtSalePaidAmount.Text & ", " & txtSaleDiscount.Text & ", " &
txtSaleNetBal.Text & ", '" & dtpSale.Value.Date & "'")
Please help me with this.
Just covert to integer using CInt(txtbox.Text)
You should also validate that the textboxs only have numeric values.

datatype mismatch in criteria expression in MS Access

I am creating form in access in which i have to implement cascading combo boxes , data in lower combo box is dependent on its parent value selected by user. Here is form
on left side is structure of the table and on right side is form. Problem is I am getting error of data type mismatch , unable to understand why this is happening. In the afterupdate event of Diametre of Drill I am populating cutting speed . Whenever I press drop down of Cutting Speed "Datatype mismatch in criteria expression" occurs. Here is code of afterupdate event of Diametre of Drill
Private Sub cboDiameterDrilling_AfterUpdate()
cboCuttingSpeedDrilling.RowSource = "Select DISTINCT tblDrilling.cuttingSpeed " & _
"FROM tblDrilling " & _
`"WHERE tblDrilling.materials = '" & cboMaterialDrilling.Value & "' AND tblDrilling.diaOfDrill = '` `cboDiameterDrilling.Value ' " & _`
"ORDER BY tblDrilling.cuttingSpeed;"
End Sub
I think problem is in WHERE Clause . Any help would be greatly appreciated. Thank you
You've surrounded the reference to the object's value (cboDiameterDrilling.Value ) in single quotes.
AND tblDrilling.diaOfDrill = ' & cboDiameterDrilling.Value & "'"
Solution : AND tblDrilling.diaOfDrill = " & cboDiameterDrilling.Value & " " & _
I think you missed a ". Try:
Private Sub cboDiameterDrilling_AfterUpdate()
cboCuttingSpeedDrilling.RowSource = "Select DISTINCT tblDrilling.cuttingSpeed " & _
"FROM tblDrilling " & _
`"WHERE tblDrilling.materials = '" & cboMaterialDrilling.Value & "' AND tblDrilling.diaOfDrill = '" & cboDiameterDrilling.Value & "' " & _
"ORDER BY tblDrilling.cuttingSpeed;"
End Sub