tt1212 > 08-12-13, 10:42 AM
Option Compare Database
Public cnn As New ADODB.Connection
Public Sub Moketnoi()
With cnn
.ConnectionString = "Provider= Microsoft.Jet.OLEDB.4.0; data source=" & _
CurrentProject.Path & "DATAKSan.mdb"
.Properties("Jet OLEDB:Database Password") = ""
.CursorLocation = adUseClient
.Open
End With
End Sub
Private Sub Form_Load()
Moketnoi
End Sub
Dim lsSQL As String
Dim lrs As New ADODB.Recordset
lsSQL = "select * from TBphong"
lrs.Open lsSQL, cnn, adOpenStatic, adLockBatchOptimistic
Set Me.Recordset = lrs
Set lrs = Nothing
End Sub
MTNQ > 08-12-13, 05:02 PM
data source=" & CurrentProject.Path & "\DATAKSan.mdb"
Xuân Thanh > 08-12-13, 05:14 PM
tt1212 > 08-12-13, 06:40 PM
Minh Tiên > 08-12-13, 07:21 PM
Xuân Thanh > 08-12-13, 08:13 PM
tt1212 > 08-12-13, 08:30 PM
Dim tb1 As Recordset, tb2 As Recordset
Set tb1 = CurrentDb.OpenRecordset("Bangkhach", dbOpenDynaset)
Set tb2 = CurrentDb.OpenRecordset("Banghoadon", dbOpenDynaset)
Do Until tb2.EOF
If tb2!Makhach <> tb1!Makhach Then
tb1.AddNew
tb1!Makhach = tb2!Makhach
tb1!Tenkhach = tb2!Tenkhach
tb1!SoDT = tb2!SoDT
Exit Do
tb1.Update
End If
tb2.MoveNext
Loop
tb1.Close
tb2.Close
Minh Tiên > 08-12-13, 10:18 PM
(08-12-13, 08:13 PM)Xuân Thanh Đã viết: Bạn tmtien261 test thủ khi Connect_ADO và Connect_Data đều là file Access ver >= 2007 chưa? Nếu có thì gửi file demo lên cho mọi người tham khảo
Thân mến
Xuân Thanh > 08-12-13, 10:36 PM
tt1212 > 08-12-13, 10:36 PM