I try to update one of field of a record in a table. It does not conplain anything after running the following Sub. But the problem is that the record is not updated. Can you please help me on this?
Table: TBL-1
Fields: Class-Name (Key), Attribute-Name(key), Code-List-Name (non-key)
Here is the code:
Private Sub UpdateAttributeCodesTbl(cd As String)
Dim db As DAO.Database
Dim strSQLUpdate As String
Dim aNm As String
Dim cNm As String
aNm = Me.Attribute_Name
cNm = Me.Class_Name
Set db = CurrentDb
strSQLUpdate = "UPDATE [TBL-1] set [TBL-1].[Code-List-Name] = '" & cd & "' WHERE [TBL-1].[Attribute-Name] = ' " & aNm & "' AND [TBL-1].[Class-Name] = '" & cNm & "'"
db.Execute (strSQLUpdate)
db.Close
Set db = Nothing
End Sub
Thanks,
chrislx
Table: TBL-1
Fields: Class-Name (Key), Attribute-Name(key), Code-List-Name (non-key)
Here is the code:
Private Sub UpdateAttributeCodesTbl(cd As String)
Dim db As DAO.Database
Dim strSQLUpdate As String
Dim aNm As String
Dim cNm As String
aNm = Me.Attribute_Name
cNm = Me.Class_Name
Set db = CurrentDb
strSQLUpdate = "UPDATE [TBL-1] set [TBL-1].[Code-List-Name] = '" & cd & "' WHERE [TBL-1].[Attribute-Name] = ' " & aNm & "' AND [TBL-1].[Class-Name] = '" & cNm & "'"
db.Execute (strSQLUpdate)
db.Close
Set db = Nothing
End Sub
Thanks,
chrislx