Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Update

Status
Not open for further replies.

chrislx

Programmer
Oct 17, 2003
32
US
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
 
You have an extra space in front of the class name, so your criteria is
[TBL-1].[Attribute-Name] = ' Class1'
instead of
[TBL-1].[Attribute-Name] = 'Class1'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top