1

Lets say I have a query like this:

Parameters Table_Name string, Field_Name string;

Update Table_Name Set Table_Name.[field1] = "new value", Table_Name.[field2] = "new Value" Where Table_Name.[Field_Name] = "Some value"

Basically I have the same query which I need to run against different tables which share some fields together. I want to be able to type the table name when I run the query.

I know this can be achieved with VBA, but this way would be a lot easier than VBA. Although VBA is also welcome but I would like to be able to do this in pure SQL.

How to achieve the above logic for table names AND field names?

1 Answer 1

2

Is this being done in MSAccess or in SQL Server? If you've got a SQL Server behind things, then you'll be looking to do some sp_executesql calls to get the job done. If you're doing this in MSAccess, you can accomplish the same by building dynamic SQL statements in VBA - either way would work if you've got Access pointing to SQL, though.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.