I have a table "tblAreas" with a field "Name".
I have a form displaying data from another table. On this form, a situation may arise when I wish to add, delete or change the value of "Name" in "tblAreas". I have written SQL statements that work for add and delete - both work. However, the update function does not. I have two variables derived from controls on the form:
varName - the current value - so WHERE can find the record to update
varNewName - the new value to update the existing value
The SQL statement is:
DoCmd.RunSQL "UPDATE tblAreas SET tblAreas.Name=varNewName WHERE tblAreas.Name=varName"
When this is executed, Access responds by asking for two parameter values - varNewName and varName
If I enter the appropriate values, the update works correctly, so the SQL code works. However, the SQL statement does not seem to pick up the variables to use.
I have a form displaying data from another table. On this form, a situation may arise when I wish to add, delete or change the value of "Name" in "tblAreas". I have written SQL statements that work for add and delete - both work. However, the update function does not. I have two variables derived from controls on the form:
varName - the current value - so WHERE can find the record to update
varNewName - the new value to update the existing value
The SQL statement is:
DoCmd.RunSQL "UPDATE tblAreas SET tblAreas.Name=varNewName WHERE tblAreas.Name=varName"
When this is executed, Access responds by asking for two parameter values - varNewName and varName
If I enter the appropriate values, the update works correctly, so the SQL code works. However, the SQL statement does not seem to pick up the variables to use.