Class Tovar:
Public Code As Integer
Public Number As String
Public manufacturer As String
Public tovar_type As String
Public group As String
Public comment As String
Основной код:
Sub main()
Dim mdb: Set mdb = Access.CurrentDb
Dim sSQL As String: sSQL = "SELECT * FROM [SOTRAS]"
Dim rst As Recordset: Set rst = mdb.OpenRecordset(sSQL)
Dim item As Tovar
Do While Not rst.EOF
Set item = New Tovar
item.Code = rst.Fields("Êîä")
item.manufacturer = rst.Fields("Ïðîèçâîäèòåëü")
item.Number = rst.Fields("Íîìåð")
item.tovar_type = rst.Fields("Òèï")
add_tovar (item)
rst.NextRecordset
Loop
rst.Close: Set rst = Nothing
mdb.Close: Set mdb = Nothing
End Sub
Sub add_tovar(a As Tovar)
.....
End sub
При запуске в строке add_tovar (item) вылетает ошибка:
Object doesn't support this property or method (Error 438)