hiding a textbox if text value is null - rdlc

I have done a research on this but can't seem to find a convincing answer. Here is the scenario. I am doing a reporting application in rdlc. I am getting field values from my database and displaying in the text boxes. Please see below what I display in the report
Textbox1
Textbox2
Textbox3
In case the value of text box 2 or any other text box is null, I don't display the same using the formular
iif(fields!Textbox2.value is nothing, false, true)
for example this is what I get
Textbox1
Textbox3
with a space between textbox1 and textbox3. I dont want this space to appear incase the value is null. How can I handle this? Thank you

If you're using a simple TextBox you have to set Visibility and CanShrink property.
If you're using a TextBox in a Table/Tablix you have to set Visibility property of the entire TableRow containing the TextBox.

Related

Getting a Value if a Field and Record number is known?

Good Evening,
I am working on a Combo Search Form that is designed to search for information by criteria. The form has a combo box containing field values and a text box beside it. The selection of a field value in the combo box will fill in the text box beside it with the relevant information for that record, all the relevant information is contained in the PetTable.
I have managed to get the combo box to display the fields from the PetTable by setting the rowSource to PetTable and the sourceType to Field List... however that's where I hit my dead end.
In the Text Box beside the combo-box I tried grabbing the value of the combo box and putting it into the textbox by making the Text box control source "=ComboBox", however this just created a textbox which has a literal text string to that of the combo box.
My next thought was to make the text box Control source "=PetTable.PetComboBox" my thought was that the PetTable references the table with my information and the "PetComboBox" becomes the field a need to get. This did not work either and gave a #Name error"
What should be happening is: In the Combo-box if I selected [Pet Name], I would hope that the textbox beside it becomes "Fido" but instead it also becomes [Pet Name].
Any and all help would be appreciated!
Thanks
Desired Effect
What you need to do is to change the Row Source Type of the Combo Box to "Table/Query". Then in the "Row Source" click on the "..." to open up the Query Builder. Select the table that you want. Add the columns that you want. I would suggest the table's primary key PetID, and then any other fields - in your case at least PetName. You may also want to sort by PetName to make it easier for the user to scroll through. Close the Query Builder and save the changes. Change the combo box's ColumnCount to 2, and set the Column Widths to be "0cm;6cm" (setting the first column to have a width of 0 means that it is not displayed to the user).
Now move to you TextBox, and set the Control Source to be:
=[Combo0].Column(1)
Note that columns in a combox box are 0-indexed, so the first column is column 0, the second (in your case containing PetName) is column 1.
As you actually want to show the field names, rather than the data in the combo box, then you will need to set the RowSourceType to be "Field List", and then select the table name as the RowSource.
You will then need a small piece of VBA to lookup the value of that field in the table for the current record:
Sub sListFieldData()
If Not IsNull(Me!Combo0) Then
Me!Text2 = DLookup(Me!Combo0, "tblPet", "PetID=" & Me!PetID)
Else
Me!Text2 = ""
End If
End Sub
And you will then need to call this procedure in the combo box's AfterUpdate event (to catch when it has been changed by the user) and also in the form's Current event (to catch when the user moves between records):
Private Sub Combo0_AfterUpdate()
Call sListFieldData
End Sub
Private Sub Form_Current()
Call sListFieldData
End Sub
Regards,

Selecting particular option from a combo box should make textbox field mandatory to enter text

I have a combo box in a form which has two options : correct and incorrect. There is another textbox field which is set not required in Required field property of the table but when combo box selection makes "incorrect", it should automatically force user to fill in textbox i.e. mandatory to fill in textbox
Could anyone please help me out how to fix this.
Thanks!
On the After Update event of the combo box check the selected value. If it is "incorrect" set the focus to the textbox and then use the After Update event of the text box to verify the conditions for filling the text box are satisfied otherwise reset the focus back to the text box (and possibly put on a message box to explain why).

Remove textbox when field is empty

I'm trying to hide a textbox when the field is empty, but it's not working:
IIf(IsNothing(First(Fields!Fld27.Value, "P2BDataSet")),true,False)
Try this in the text box visibility property
iif(Fields!YouField.Value>0, false, true)
If you still you did not get what you want, check How to Hide RDLC Textbox Based on Value

MS Access: text box value show #Name?

I have created a form and set the form's RecordSource to a query. Below is my query:
SELECT GeneralT.*, SalaryT.[Status]
FROM GeneralT INNER JOIN SalaryT ON GeneralT.Deposits = SalaryT.Deposits;
In the form I have 4 textboxes. In the first 3 textboxes I show value from GeneralT table and in fourth textbox I show SalaryT.[Status] value. But this fourth value doesn't show in the textbox rather it show #Name?.
If I open the query in datasheet view I can see all the value properly. I don't understand what is wrong here. Please help me to show the result properly in the form.
Displaying #Name? for a field says that field has a control source that does not match with the query linked to the form. Some things to check:
Make sure Status is a selection from one of the pre-existing options in the Control Source drop down combo box. Click on the combo box to make sure.
Double check to make sure it is a "Text Box" and not a custom
control.
Make sure there isn't another text box named Status
Try chaning the control source to just Status instead of SalaryT.[Status]. If the field name does not conflict with the naming of a field in GeneralT, the selected SalaryT.[Status] will actually be displayed named Status.

setting textbox text equal to textbox text on a different form?

is it possible in design mode to set the textbox text property to the text property of a textbox in a different form in vb.net?
You could use the ApplicationSettings.PropertyBinding property of the text box to accomplish what you want. If you sort the text box properties A-Z, it should be the first one in the list in parenthesis. Just create a shared application value and it will apply to each control that binds to the value.