Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio Button Value problem 1

Status
Not open for further replies.

jimmythegeek

Programmer
May 26, 2000
770
US
I dynamically generate a set of radio buttons depending on how many records are in a given table (anywhere between 4 and 20). I need to get the value of the one that's selected. The name of the form is frmOtherAdmin, and the name of the radio buttons are radEntity. However I cannot get a value. Any help is greatly appreciated, Thanks in advance.

===============
Dim val, i
With frmOtherAdmin
For i = 0 to .radEntity.Count
If .radEntity(i).checked Then
val = .radEntity(i).value
Exit For
End If
Next
End With Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
I assum you are getting an error because .radEntity(i) does not exists when I = .radEntity.Count. Because a Control Arrays is 0-based,the index of the last item is .radEntity.Count - 1.
Dim val, i
With frmOtherAdmin
For i = 0 to .radEntity.Count - 1
If .radEntity(i).checked Then
val = .radEntity(i).value
Exit For
End If
Next
End With Compare Code (Text)
Generate Sort in VB or VBScript
 
Thanks, I will try that, in fact I noticed after I had posted the question, that I had forgotten the -1. I just went ahead and handled on the server instead of the client. It's easy that way, you can just do a response and get the value that is selected. Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top