by Victor Francisco Cajarito (3 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 12th August 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Using ActiveX Data Controls(ADO), transfering the content(records) of one table to another, this will be a great program.... and it will help
'Victor Francisco Cajarito
'STI-College Caloocan Philippines(LAN Admin, Programmer)
'Email: [email protected]
'[email protected]
'[email protected]
'Transfering All records to a diffent Table Name
'*********
2
Private Sub Command1_Click()
Dim icounter As Integer
Dim dtart As Double, dfinish As Double
Dim pnlstatus As Panel
Static i As Integer
Set pnlstatus = Form1.StatusBar1.Panels(1)
dstart = Timer
Adodc1.Refresh
Adodc2.Refresh
On Error Resume Next
ProgressBar1.Visible = True
pnlstatus.Text = "Transfering data please wait...."
StatusBar1.Refresh
ProgressBar1.Max = Val(Text1.Text)
For icounter = 1 To Val(Text1.Text)
If icounter Mod 10 = 0 Then ProgressBar1.Value = icounter
Next icounter
pnlstatus.Text = "Transfer Complete...."
StatusBar1.Refresh
'transfer the record to new table
For i = 0 To Adodc1.Recordset.RecordCount
Adodc2.Recordset.AddNew
Adodc2.Recordset("EmpNum") = Adodc1.Recordset("Empnum")
Adodc2.Recordset("EmpName") = Adodc1.Recordset("EmpName")
Adodc1.Recordset.MoveNext
Next i
Adodc1.Refresh
Adodc2.Refresh
'delete the record after transfering
For i = 0 To Adodc1.Recordset.RecordCount
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Next i
'end of deletion
dfinish = Timer
pnlstatus.Text = "Ready..."
ProgressBar1.Value = 0
ProgressBar1.Visible = False
Command2.Enabled = True
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Dim icounter As Integer
Dim dtart As Double, dfinish As Double
Dim pnlstatus As Panel
Static i As Integer
Set pnlstatus = Form1.StatusBar1.Panels(1)
dstart = Timer
Adodc1.Refresh
Adodc2.Refresh
On Error Resume Next
ProgressBar1.Visible = True
pnlstatus.Text = "Returning data please wait...."
StatusBar1.Refresh
ProgressBar1.Max = Val(Text1.Text)
For icounter = 1 To Val(Text1.Text)
If icounter Mod 10 = 0 Then ProgressBar1.Value = icounter
Next icounter
pnlstatus.Text = "Return Complete...."
StatusBar1.Refresh
'transfer the record to new table
For i = 0 To Adodc2.Recordset.RecordCount
Adodc1.Recordset.AddNew
Adodc1.Recordset("EmpNum") = Adodc2.Recordset("Empnum")
Adodc1.Recordset("EmpName") = Adodc2.Recordset("EmpName")
Adodc2.Recordset.MoveNext
Next i
Form1.Adodc1.Refresh
Form1.Adodc2.Refresh
'delete the record after transfering
For i = 0 To Adodc2.Recordset.RecordCount
Adodc2.Recordset.Delete
Adodc2.Recordset.MoveNext
Next i
'end of deletion
dfinish = Timer
pnlstatus.Text = "Ready..."
ProgressBar1.Value = 0
ProgressBar1.Visible = False
Command2.Enabled = False
Command1.Enabled = True
End Sub
Private Sub Command3_Click()
End
End Sub
No comments have been posted about Using ActiveX Data Controls(ADO), transfering the content(records) of one table to another, this wi. Why not be the first to post a comment about Using ActiveX Data Controls(ADO), transfering the content(records) of one table to another, this wi.