Listview 参数在vb6中不是可选的
为什么我会犯这个错误?这个代码是正确的,但为什么呢Listview 参数在vb6中不是可选的,listview,ms-access,vb6,runtime-error,Listview,Ms Access,Vb6,Runtime Error,为什么我会犯这个错误?这个代码是正确的,但为什么呢 Private Sub loadEmployee() With frmEmployee.lvEmployee.ListItems Call connect 'SQL = "SELECT * FROM tblemployee " Rs.Open "SELECT * FROM tblemployee ", Conn, adOpenDynamic, adLockOptimistic If Not Rs.EOF Then Rs.MoveLa
Private Sub loadEmployee()
With frmEmployee.lvEmployee.ListItems
Call connect
'SQL = "SELECT * FROM tblemployee "
Rs.Open "SELECT * FROM tblemployee ", Conn, adOpenDynamic, adLockOptimistic
If Not Rs.EOF Then
Rs.MoveLast
Set Item = lvEmployee.ListItems.Add(1, , Rs!id)
Item.SubItems(2) = Rs!firstname
'Item.SubItems(2) = Rs!middlename
Item.SubItems(3) = Rs!lastname
Item.SubItems(4) = Rs!agename
Item.SubItems(5) = Rs!gender
Item.SubItems(6) = Rs!address
Item.SubItems(7) = Rs!datehired
Item.SubItems(8) = Rs!birthdate
Item.SubItems(9) = Rs!birthplace
Item.SubItems(10) = Rs!citizenship
Item.SubItems(11) = Rs!cellno
Item.SubItems(12) = Rs!Status
Item.SubItems(13) = Rs!basicsalary
Item.SubItems(14) = Rs!designation
Item.SubItems(15) = Rs!department
'Item.SubItems(16) = Rs!m_name
'Item.SubItems(17) = Rs!m_occupation
'Item.SubItems(18) = Rs!n_spouse
'Item.SubItems(19) = Rs!dependents
'Item.SubItems(20) = Rs!SSS
'Item.SubItems(21) = Rs!PHILHEALTH
'Item.SubItems(22) = Rs!PAGIBIG
Item.EnsureVisible
End If
Rs.Close
Conn.Close
Set Conn = Nothing
End With
End Sub
错误:
Arguments not optional
真的很难接受这个。呼叫时出现此错误。我是这样呼叫的:
Private Sub Form_Load()
loadEmployee
End Sub
如何修复此问题?您是否声明了
项
尝试声明:
Dim Item as listitems
哪个语句生成了错误?突出显示的黄色:“Private sub…”突出显示的蓝色:“Item=”您可以显示Item
@handymann的声明并始终使用选项Explicit
!它会立即标记此错误。