G
Guest
I am trying to update a field in a different table and having no luck with my
code shown below, does anyone know why this is not working. I get a
Run-time error '3219' "Invalid operation".
Private Sub cmdSave_Click()
Dim db As DAO.Database
Dim rst As DAO.Database
Dim strSQL As String
Set db = CurrentDb
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Set rst = db.OpenRecordset("UPDATE tblDBNotes INNER JOIN tblCollections
ON (tblDBNotes.CustomerNo = tblCollections.xMember) " & _
"AND (tblDBNotes.MCNumber = tblCollections.xMC) SET
tblCollections.HasAdditionalNotes = True " & _
"WHERE (((tblCollections.HasAdditionalNotes)=False) AND
((tblCollections.xMember)=[Forms]![frmDBNotes]![CustomerNo]) " & _
"AND ((tblCollections.xMC)=[Forms]![frmDBNotes]![MCNumber]));")
DoCmd.RunSQL strSQL
rst.Close
DoCmd.Close
End Sub
code shown below, does anyone know why this is not working. I get a
Run-time error '3219' "Invalid operation".
Private Sub cmdSave_Click()
Dim db As DAO.Database
Dim rst As DAO.Database
Dim strSQL As String
Set db = CurrentDb
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Set rst = db.OpenRecordset("UPDATE tblDBNotes INNER JOIN tblCollections
ON (tblDBNotes.CustomerNo = tblCollections.xMember) " & _
"AND (tblDBNotes.MCNumber = tblCollections.xMC) SET
tblCollections.HasAdditionalNotes = True " & _
"WHERE (((tblCollections.HasAdditionalNotes)=False) AND
((tblCollections.xMember)=[Forms]![frmDBNotes]![CustomerNo]) " & _
"AND ((tblCollections.xMC)=[Forms]![frmDBNotes]![MCNumber]));")
DoCmd.RunSQL strSQL
rst.Close
DoCmd.Close
End Sub