O posibilă soluţie:
Sub ProceduraPestilorPrajiti()
Dim rs_t1 As Recordset, rs_t2 As Recordset
Set rs_t1 = CurrentProject.Connection.Execute("SELECT * FROM T1", , adOpenForwardOnly)
Set rs_t2 = CurrentProject.Connection.Execute("T2", , adOpenDynamic)
While Not rs_t1.EOF
If IsNull(rs_t1.Fields("Programe").Value) Then
rs_t2.AddNew
rs_t2.Fields("Programa").Value = rs_t1.Fields("Programe").Value
rs_t2.Fields("Bucati").Value = 0
'.............................
rs_t2.Update
Else
Dim vPrograme() As String, iIndex As Integer
vPrograme = Split(Trim(rs_t1.Fields("Programe").Value), ";")
For iIndex = LBound(vPrograme) To UBound(vPrograme)
Dim strInfo As String, strPrograma As String, lngBucati As Long
strInfo = vPrograme(iIndex)
strPrograma = Mid(strInfo, 1, InStr(strInfo, ":") - 1)
lngBucati = CLng(Mid(strInfo, InStr(strInfo, ":") + 1, 10000))
rs_t2.AddNew
rs_t2.Fields("Programa").Value = strPrograma
rs_t2.Fields("Bucati").Value = lngBucati
'.............................
rs_t2.Update
Next iIndex
End If
rs_t1.MoveNext
Wend
rs_t1.Close
MsgBox "Pestii au fost prajiti !"
End Sub