Execute field values as SQL in MS Access
Suppose that we have a table with a field e.g. SqlStateMent How do I execute all the statements? My real problem is that I am trying to insert all the tables into one table, I know how to get name of all the tables, and make sql statements. I don't want to just execute the statements, but to make the commands first and keep them in a table, then execute them.
An SQL statement is a string. A VBA variable can be set to the SQL statement string and then the variable can be referenced as if referencing the statement directly. Referencing a field that holds an SQL statement string is like referencing a VBA variable. However, only action SQL statements (UPDATE, DELETE, INSERT) can be 'executed'. SELECT SQL statements can be referenced to open a recordset object or to set a RecordSource or RowSource property. So, assume the SQL statement saved in the field is DELETE FROM tablename and textbox or combobox or listbox on form is bound to that field. The SQL statement can be executed with code behind that form: CurrentDb.Execute Me!fieldname CurrentDb.Execute Me.controlname That code will take field or control value from record that has focus. Why do you need to do this? Exactly what are you trying to accomplish?
Can you use ADO to edit table schema in MS Access?
Access 2010: 'the expression cannot be used in a calculated column'?
ACCESS SubForm: trying to add records
Checking social security numbers and business identity codes in Access 97
MS Access VBA Substitution Cipher Encrypt/Decrypt
How to get SQL from column/query schema in Access
MS Access sub-sub forms
Access 2010 web compatibility error: ACCWeb107019
MS ACCESS: Populate a subform with data from another table
how to read one field from one record
How do you dynamically create controls on a MS Access form?
MS Access date sorting with date/time components combined in one text field
Using Access 2003 VBA, I want to be able to have a report come up on the screen, not print out. But it doesn't work
“invalid use of null” for vba function that returns variant
Refresh combo box in Access 2007 without coding
select top 700 * from objectaer work only in sqlserver 2005 but 2008