How to filter through a dropdown list with radio buttons in Data Entry Form
I have a large number of values to be displayed in a dropdown list in the Data Entry Form and am trying to figure out how to display a select group of the total values in the dropdown list via 2 separate radio buttons with 2 options each, also in the data entry form. I am not too familiar with VB scripting and came up with something like this for the dropdown menu:
Select Case Format.NamedSubStrings("RadioButton1").Value
Case "RadioButton1OptionA"
if Format.NamedSubStrings("RadioButton2").Value = "RadioButton2OptionA" then
Value="X + vbCr + ...."
else if Format.NamedSubStrings("RadioButton2").Value = "RadioButton2OptionB" then
Value="Y + vbCr + ...."
end if
Case "RadioButton1OptionB"
if Format.NamedSubStrings("RadioButton2").Value = "RadioButton2OptionA" then
Value="X2 + vbCr + ...."
else if Format.NamedSubStrings("RadioButton2").Value = "RadioButton2OptionB" then
Value="Y2 + vbCr + ...."
end if
end select
When I run it, I get the error: "OnFillList(Line17): Case "RadioButton1OptionB": Expected Statement
(Line 17 is the "Case "RadioButton1OptionB"" in this script)
There are no data sources connected to the radio buttons and the 2 list items on each radio button are entered through embedded data. The dropdown list is not connected to a data sourceand I hope to fill the dropdown list with the VB script. Does anyone have any solutions as to how to make this script work so that I can choose which values are displayed in the dropdown menu? Or are there any other ways to make this work?
-
Jose Adam Flores Sr.
★ BarTender Hero ★
Hello, not knowing how are the dropdown's are filled, I would like to suggest
to change Value's as shown below,
Also if vbCr, doesn't give you a new line try vbCrLf,
Please let us know if it works or not,
So if it works everyone else will be able to use the solution if they ever come across the same situation
Thank you.
Select Case Format.NamedSubStrings("RadioButton1").Value
Case "RadioButton1OptionA"
if Format.NamedSubStrings("RadioButton2").Value = "RadioButton2OptionA" then
Value = "X" & vbCr & "...." 'in this you will be appending the values
else if Format.NamedSubStrings("RadioButton2").Value = "RadioButton2OptionB" then
' Value="Y + vbCr + ...." in this format you are creating a whole string for the returning value
' and not the individual variables passed as separated values by a vbCr
Value = "Y" & vbCr & "...." ' in this you will be appending the values, whatever the "...." means
end if
Case "RadioButton1OptionB"
if Format.NamedSubStrings("RadioButton2").Value = "RadioButton2OptionA" then
'Value="X2 + vbCr + ...."
Value = "X2" & vbCr & "...." ' in this you will be appending the values
else if Format.NamedSubStrings("RadioButton2").Value = "RadioButton2OptionB" then
'Value = "Y2 + vbCr + ...."
Value = "Y2" & vbCr & "...." ' in this you will be appending the values
end if
end select0 -
Peter Thane
★ BarTender Hero ★
Have you tried adding the dropdown list onto a 2nd Data Entry Form too rather than leave on it on the same one as the radio buttons? I am not sure when the script would be run but it could be when the form opens.
0 -
Michael Rowe
★ BarTender Hero ★
How can I add a 2nd Data Entry form? I'm not seeing an option to do so at the tabs at the bottom of the screen.
0 -
Peter Thane
★ BarTender Hero ★
There should be an option here:
0 -
Michael Rowe
★ BarTender Hero ★
Hi Peter Thane,
I don't have that option at the bottom of my window, do you know why that could be?
0 -
Jose Adam Flores Sr.
★ BarTender Hero ★
Please state what version of Bar Tender you are Using.
In older versions of Bar Tender Like 10.1, it doesn't show that icon,
in newer versions is available, Like I have 2021 version and it is available.
But then gain, I don't see what exactly you are trying to accomplish.
Maybe you should Download a 30 day trial of the Latest version and see if that helps you
and if it doesn't do what you want to accomplish then no harm done.
then it is time to try a different approach.
Try describing the process of what you want to do instead of posting the vb code (Which you already did in the beginning)
or if you have a format the upload it so it can be tested and see what you have done so far.
0
Please sign in to leave a comment.
Comments
6 comments