
how VB update Table A INNER JOIN Table B, Set A.co=B.ID
Hi yuli,
Taking Dougs words for granted, but the below works for me:
Dim conn As ADODB.Connection
Dim sSQL As String
sSQL = "UPDATE TblRelation SET TblRelation.Residence = 'New York' WHERE
(((TblRelation.ID)=2));"
Set conn = New ADODB.Connection
With conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "data source=D:\MyDocs\Access\NAW.mdb"
.Open
.Execute sSQL
End With
Set conn = Nothing
Kind regards,
Perry
Quote:
> How vb update a table when this table inner join table b
> Table A and Table B are in Different Access Database file.
> table A.Co = Table B.ID, Set Table A.Remark = New
> Private Sub Form_Load()
> conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & _
> "\A.mdb;Persist Security Info=False"
> Set objRe = New ADODB.Recordset
> conString1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &
_
> "\B.mdb;Persist Security Info=False"
> Set objUpd = New ADODB.Recordset
> End Sub
> -------------------------------------------------
> Private Sub UpdateDB_Click()
> With objUpd
> If .State = adStateOpen Then .Close
> .ActiveConnection = conString1
> .Source = "UPDATE A INNER JOIN B ON A.co = B.id SET A.remark = "new"
> .Open
> End With
> End Sub
> thank you