做关联啊打开需要设置的ACCESS的数据库,点击【工具】-【关系】,再打开需要关联的数据表,将关联的字段拖过来即可。
Update A Set 备注 = (Select 备注 From B WHERE A.姓名 = B.姓名)
Private Sub Command1_Click() Dim conn As ADODB.Connection Dim rs As ADODB.Recordset Dim strSql As String Set conn = OpenConnForAccess("test.mdb") strSql = "insert into b select * from c" RunTrans strSql, conn end sub Public Function OpenConnForAccess(ByVal FileName As String) As ADODB.Connection Dim AdoConn As New ADODB.Connection With AdoConn .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FileName & ";Persist Security Info=False" .Open End With Set OpenConnForAccess = AdoConn End Function Public Function RunTrans(ByVal tranSql As String, ByVal AdoConn As ADODB.Connection) With AdoConn .BeginTrans .Execute tranSql .CommitTrans End With End Function 两张表格的字段不是完全相同的 ___________________________ strSql = "insert into b(id,num) select id,num from c" 0