I have a text box that contains an expression, however i dont want it to be affected by the selections in the list boxes.
=SUM(IF( (date(Monthname(C_DATE),'MMM-YY')) >=(AddMonths(Today(),-12)),1,0))
Using the {1} prefix in the expression will ignore all selections from listboxes (or other).
=Sum({1} If((Date(Monthname(C_DATE), 'MMM-YY')) >=(AddMonths(Today(),-12)), 1, 0))
Related
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,
I have Form!Main in access with 3 list boxes(choose a report, choose a cohort, choose a year) that grab data from the following respective tables (x_report_box, x_cohort_box, x_year_box).
The second box is populated based off the selection in the first box.
Consequently, the third box is populated based off the selection in the second box.
The second box gets populated just fine once I make a selection in the first box. However, the third box stays blank after I make a selection in the second box.
In the first box under the property sheet in the AfterUpdate I've added a Me.List2.Requery As well as for the second box Me.List3.Requery.
The code I used to populate the second box was
SELECT coh.cohort_name
FROM x_cohort_box AS coh
WHERE (((coh.report_id)=[Forms]![Main]![List1]));
The code I used to populate the third box was
SELECT yr.year_name
FROM x_year_box AS yr
WHERE (((yr.cohort_id)=[Forms]![Main]![List2]));
Any insight would be appreciated. Thanks!
I don't quite understand the differences between the combobox properties SelText and Text.
If I want to send the content of a combobox as a parameter to another procedure, should I send .text or .selText?
If I want to make enter text into a combobox using a macro, should I write the text in .selText or .Text?
The difference is really given in the name (SelText vs. Text) where Sel stands for Selected. One is used to return or modify the selected text (i.e. SelText) and the other is used to return or modify the entire text (i.e. Text).
If no text is selected in the ComboBox then they return and modify the same value.
I suspect you want to use Text unless you are specifically interested in the selected text.
This appears to be consistent for an ActiveX control on a Worksheet or for a control on a User Form.
how to automatically include alphabetic characters in a text box based on the selection from combo box in vb.net,leaving the other spaces for the user to enter .say the text box contains 8 characters (eg. 117CS227 ).the CS in text box must automatically include leaving the remaining first and last three spaces for the user to enter in the text box.this text should automatically include based on the selection from combo box.
eg say there are three selections from combo box (computers ,biology,maths) . if the user selects computers then the text box below the combo box must include cs in them and for biology and maths ,they should include bg and ms respectively in the text box.
(the text box and combo box are in the same form)
Hope someone can help as I am quite new to SSRS, I am trying to hide a text box that has an expression in it. When multiple values from a drop down parameter are selected I want to hide the box but when only one option is selected I want to show just the one option.
I currently have a text box with the following expression in it
=First(Fields!Name.Value, "ABC")
The above currently shows the first Value from a field which is correct, but when as I said there are more values selected, I want to hide this, I am not sure if I need to wrap the above expression in something or change this in the Text Box properties under visibility
I have been trying to add the following expression under the Text Box Properties/Visibility option, but not having much luck
=Iif(Parameters!Supplier.IsMultiValue > 1, True, False)
I am using SSRS 2012 though I am sure what I am trying to do is quite easily done in every other version.
Hope someone can help, P
As a multi value parameter is an array, you need to use a formula like this:
=Iif(Parameters!Supplier.Value.Length > 1, True, False)
or as suggested by the OP
=Iif(Parameters!Supplier.Count > 1, True, False)