请大家帮我看一下!
我做的是局域网聊天软件,服务器端的添加用户出现问题,源代码如下:Private Sub CMDOK_Click()
Dim name As String, sex As Boolean, a As Integer
usergroup.Enabled = True
name = fields(0).Text
If Len(name) = 0 Then
Exit Sub
End If
If sexmw.Text = "男" Then sex = True Else sex = False
If fields(1).Tag = "addu" Then
Server.rc.AddNew
For a = 0 To usergroup.ListCount - 1
If usergroup.list(a) = name Then
CMDOK.Enabled = False
MsgBox "该用户名已存在,用户名不能重复", vbOKOnly + vbSystemModal + vbExclamation, "错误"
Exit Sub
End If
Next a
Server.rc(0).name = name
usergroup.AddItem name
Else
Server.rc.Edit
If fields(0).Tag <> name Then
For a = 0 To usergroup.ListCount - 1
If usergroup.list(a) = fields(0).Tag Then
usergroup.list(a) = name
Server.rc(0).name = name
Exit For
End If
Next a
End If
End If
Server.rc(1) = sex '性别 运行是这里总是出错
Server.rc(2) = fields(2) '职务
Server.rc(5) = fields(1) '密码
Server.rc.Update
CMDOK.Enabled = False
Beep
MsgBox "修改成功", vbOKOnly
End Sub