Dim i As Integer
Dim j As String
Dim k As String
Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
Set con = CurrentProject.Connection
With cmd
.ActiveConnection = con
.CommandType = adCmdText
If listbox1.ListCount <> 0 Then
For i = 0 To listbox1.ListCount - 1
j = Me!listbox1.ItemData(i)
If combox.value <> "" Then
k = combox.value
Else
MsgBox "请选择部门名称!"
End If
'下一句中,部门名称,字段,P为字段表中的字段,k为combox的选中项,j为listbox1中的列表项,都是变量,下面语句应该如何写,错在哪里
.CommandText = "Update 字段表 set (部门名称 = '" & k & "' ,字段 = '" & j & "' ,p = false) where 部门名称 = '" & k & "'"
.Execute
Next
End If
End With
[此贴子已经被作者于2002-10-6 9:22:56编辑过]
[此贴子已经被作者于2002-10-6 9:28:18编辑过]
[此贴子已经被作者于2002-10-6 14:50:28编辑过]
|