[求助]combo的更新
每次用这个,更新就会有错,会把我选择修改的还留在列表中,而把列表中的最后一个给删除了,问题应该出在Combo1.RemoveItem Combo1.NewIndex,麻烦大家帮忙看看,谢谢!!Private Sub Command2_Click()
Set objCon = CreateObject("ADODB.Connection")
objCon.Open "Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial Catalog=student;Data Source=PC40319"
Set objRs = CreateObject("ADODB.RecordSet")
strexec = "Update XBMCB Set xbmc='" & Combo1.Text & "' Where xbbh='" & Text1.Text & "'"
objCon.Execute (strexec)
Combo1.RemoveItem Combo1.NewIndex
Combo1.AddItem Combo1.Text
MsgBox "数据更新成功!", 0 + 64, "系统信息"
Combo1.Text = "": Combo1.SetFocus
Set objRs = objCon.Execute("select top 1 xbbh from xbmcb order by xbbh desc")
Text1.Text = objRs("xbbh") + 1
Command1.Enabled = True: Command2.Enabled = False: Command3.Enabled = False
End Sub