Hello, I am trying to update a table with the value of a text box on the form where the table to update is as selected from a combo box on the form.
I keep getting the following
Error message:
Run-time error ‘2465’
Microsoft Access can’t find the field ‘“ & table_to_update & “’ referred to in your expression
But really can't see what I've done wrong. Have checked that the table_to_update string does contain the name of the table so guess it must be sql..
Any help much appreciated
I keep getting the following
Error message:
Run-time error ‘2465’
Microsoft Access can’t find the field ‘“ & table_to_update & “’ referred to in your expression
But really can't see what I've done wrong. Have checked that the table_to_update string does contain the name of the table so guess it must be sql..
Any help much appreciated
Code:
Private Sub Command91_Click()
Dim table_to_update, sql_string As String
table_to_update = Me.Combo49
Debug.Print table_to_update
sql_string = "UPDATE [" & table_to_update & "] SET [" & table_to_update & "].[Project] = """ & Text89.Value & """ WHERE [" & table_to_update & "].[ID] = " & Forms![T_entity]![" & table_to_update & "]![ID] & ""
db.Execute sql_string
End Sub