ms-access


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?

Related Links

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

Categories

HOME
arduino-uno
asp.net-core
wso2
isabelle
azure-data-factory
drivers
pycharm
react-router
spring-cloud-stream
analysis
yarn
baqend
ravendb
ojdbc
serverspec
spring-tool-suite
alignment
msp430
try-catch
dosgi
aurigma
undefined
excel-vba-mac
alpine
jasonette
opennlp
su
bootstrap-duallistbox
c++-amp
fabric8
media-queries
google-cloud-endpoints-v2
http-referer
atl
mapbox-gl
http-digest
serverside-rendering
hilbert-curve
splice
hp-ux
reportingservices-2005
android-mediaprojection
websphere-mq-fte
angular2-meteor
pango
react-scripts
rails-routing
yii2-extension
namecoin
zendesk-app
mediaelement
heidisql
etsy
plottable.js
hover-over
bluemix-app-scan
goose
independentsoft
xpath-1.0
system.management
rtbkit
prerequisites
intel-fortran
python-3.2
quicklisp
android-listview
microbenchmark
e10s
c++03
facebook-graph-api-v2.4
oxwall
qpainter
java.util.concurrent
file-copying
markers
jquery-layout
kgdb
datagridviewcolumn
concurrent-collections
jmapviewer
odata4j
ruby-datamapper
ora-00911
android-screen-support
e4x
cascalog
vdsp
rfc1123
yui-datatable
inotifycollectionchanged
locate
gdlib
imac
wise
icanhaz.js
compiler-specific
web-architecture
nintendo-ds
virtual-functions
port-number
multiple-languages
windows-live-messenger

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App