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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting Array Values into dbase 1

Status
Not open for further replies.

RTDesi

MIS
Apr 17, 2001
24
0
0
US
Basically, I have an array of option buttons (radio buttons) and I want to loop through them to see which one is selected, then insert that value into the database (where the field name is TOPICS) The code is as follows :
Dim X
For X = 0 To Me.optCategory.Count - 1
Select Case optCategory(X).Value
Case optCategory(0).Value = True
Adodc1.Recordset.Fields("TOPICS") = "SOFTWARE"
Case optCategory(1).Value = True
Adodc1.Recordset.Fields("TOPICS") = "MPG"
Case optCategory(2).Value = True
Adodc1.Recordset.Fields("TOPICS") = "ACE"
Case optCategory(3).Value = True
Adodc1.Recordset.Fields("TOPICS") = "V2500"
Case optCategory(4).Value = True
Adodc1.Recordset.Fields("TOPICS") = "JT8D"
Case optCategory(5).Value = True
Adodc1.Recordset.Fields("TOPICS") = "JT9D"
Case optCategory(6).Value = True
Adodc1.Recordset.Fields("TOPICS") = "PW2000"
Case optCategory(7).Value = True
Adodc1.Recordset.Fields("TOPICS") = "PW4000"
End Select
Next X

I've also tried various other ways, but everytime the only ones that insert correctly are the first and last values (SOFTWARE and PW4000). ANy other selection inserts as 'SOFTWARE' Any help on this would be GREATLY appreciated. Thanks in advance.
 
I don't remember for sure, but don't you have
to provide a break or some such statement to keep
the case statement from continuing on to to the
next choice? Jim

oracle, vb
 
For X = 0 To Me.optCategory.Count - 1
if optCategory(x) then
Adodc1.Recordset.Fields("Topics") = _
optCategory(X).Tag
endif
Next X
Of course, You shoud set Property Tag in Design View or in
Form_load Event:
optCategory(0).Tag = "SOFTWARE"
optCategory(1).Tag = "MPG"
optCategory(2).Tag = "ACE"
optCategory(3).Tag = "V2500"
optCategory(4).Tag = "JT8D"
optCategory(5).Tag = "JT9D"
optCategory(6).Tag = "PW2000"
optCategory(7).Tag = "PW4000"

 
Here is an other way:
Sub optCategory_Click (Index as Integer)
Adodc1.Recordset.Field("Topics")= _
optCategory(Index).Tag
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top