Автор вопроса: fuzytsfcrew | Web-сайт:video-edit.com.ua | ICQ: 314339
мне нужно с одной таблици (baza: number, name, profession, ceh, rozryad, trudoemkost)
скопировать нужные поля (profession, ceh, rozryad, trudoemkost) записи
в другую (out: profession, ceh, rozryad, trudoemkost, zarplata)
с критерием WHERE ceh=' & Combo1.Text'
засовываю нужные мне данные в новый recordset и пихаю в другой, а оно матерится, что объект закрыт.
....
cnnDBF.ConnectionString = ...
cnnDBF.Open
cnnMDB.ConnectionString= ...
cnnMDB.Open
....
Dim cmd As New ADODB.Command
Dim ar() As Variant
Dim i As Integer
ar() = cnnDBF.Execute("SELECT profession, ceh, rozryad, trudoemkost FROM baza ORDER BY number".GetRows
Решил по записи действовать, чтоб прогресс бар можно было подрубить, а оно не пашет. Что не так?
Dim sConnection1 As ADODB.Connection
Dim sRecordset1 As ADODB.Recordset
Dim nomerceha As String
Set sConnection1 = New ADODB.Connection
sConnection1.CursorLocation = adUseClient
sConnection1.Mode = adModeReadWrite
sConnection1.Open "Provider=Microsoft.Jet.OLEDB.4.0ata Source=c:\NormForm\Data\norm.mdb;Persist Security Info=False"
Set sRecordset1 = New ADODB.Recordset
nomerceha = CStr(Combo1.Text)
sRecordset1.Open "SELECT * FROM baza WHERE ceh LIKE' & nomerceha'", sConnection1, adOpenDynamic, adLockOptimistic, adCmdUnknown
Dim sConnection2 As ADODB.Connection
Dim sRecordset2 As ADODB.Recordset
Set sConnection2 = New ADODB.Connection
sConnection2.CursorLocation = adUseClient
sConnection2.Mode = adModeReadWrite
sConnection2.Open "Provider=Microsoft.Jet.OLEDB.4.0ata Source=c:\NormForm\Data\norm.mdb;Persist Security Info=False"
Set sRecordset2 = New ADODB.Recordset
sRecordset2.Open "SELECT * FROM out", sConnection2, adOpenDynamic, adLockOptimistic, adCmdUnknown
With sRecordset1
Do Until .EOF
sRecordset2.AddNew
sRecordset2.Fields("profession".Value = .Fields("profession".Value
sRecordset2.Fields("ceh".Value = .Fields("ceh".Value
sRecordset2.Fields("rozryad".Value = .Fields("rozryad".Value
sRecordset2.Fields("trudoemkost".Value = .Fields("trudoemkost".Value
.MoveNext
Loop
End With