Skip to Content
0
Former Member
Mar 27, 2010 at 11:02 AM

Combo data entry

19 Views

Hello freind

i creating one form which have two combobox one is Jobtitle and brench.on form load i creating code for data insert in combobox at the time loading but sir when i run the code it insert one data from database when it move to insert data second time in loop it give error like

Valid Value= valid value already exist""

pls sugeest me for it this is me code

Sub AddjobtitleCombo()

Dim Rs As SAPbobsCOM.Recordset

Dim Bob As SAPbobsCOM.SBObob

Dim s As String

Rs = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

oCombo = oform.Items.Item("4").Specific

s = "select JobTitle from [OHEM]"

Rs.DoQuery(s)

Rs.MoveFirst()

For k As Integer = oCombo.ValidValues.Count - 1 To 0 Step -1

oCombo.ValidValues.Remove(k, SAPbouiCOM.BoSearchKey.psk_Index)

Next

If (oCombo.ValidValues.Count >= 0) Then

While Rs.EoF = False

oCombo.ValidValues.Add(Rs.Fields.Item("JobTitle").Value, Rs.Fields.Item("JobTitle").Value)

Rs.MoveNext()

End While

oCombo.ValidValues.Add("ALL", "")

End If

End Sub