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?
How can I find all the MS Access security groups in VBA
Drop all connection to MS Access Database using ADO.NET
Import MS Access to CSV on Mac programmatically
MS Access - Is there a limit to Public Functions/Routines in MS Access? RTE #7?
Need to Allow Null or “” values for Dates - Access Query Data type mismatch
How to migrate MS access database to Oracle?
How to make a delete query in design view
Reserved error (-1524)
MS Access Import Error Table
Access 2007 Locking Issue - Attachments being overwritten
How to use a XSD schema definition file to bulk insert records with fixed-width columns into a database?
VB in Access 2000 : ado query got different result each time?
Using “OutputTo” to create a report that has VBA code
Access 2007 : Error 2950 appears only in ACCDE
How to INSERT SQL statements INTO table