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

How can I find all the MS Access security groups in VBA
Dropdownmenu's linked?
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

Categories

HOME
maven
server
iterator
iot
spagobi
jsp-tags
infragistics
amazon-ecs
jpeg
survey
mvvmcross
pheatmap
vault
row
correlation
visual-studio-cordova
quickfix
quartz-scheduler
jsdoc
beyondcompare
reverse-proxy
kryo
xlsxwriter
sylius
tibco-mdm
dynamic-featured-image
intel-pin
virtualdub
windows-server-2000
windowbuilder
gtrendsr
openoffice.org
xmlreader
ghost4j
xcode-extension
xenforo
email-templates
arena-simulation
websphere-mq-fte
dandelion
tactic
knockout-components
spring-mongodb
visual-c++-2008
url-pattern
google-feed-api
passport-google-oauth
vmware-tools
slicknav
phishing
fuzzy-search
blackberry-10
testng-dataprovider
rvest
captivenetwork
php-internals
javax.sound.midi
wireshark-dissector
browser-bugs
twirl
inmobi
directoryservices
pick
c3
network-interface
asp.net-web-api-odata
responsive-slides
undefined-reference
runtime.exec
google-cloud-save
file-locking
chronoforms
enterprisedb
http-unit
specification-pattern
google-email-migration
twrequest
dotnethighcharts
gnu-prolog
qt-jambi
coercion
rfc1123
yetanotherforum
appendto
yui-datatable
floating
.nettiers
castle-monorail
webkit.net
adrotator
data-driven
uimenucontroller
zune
w3wp
geneva-server
django-notification
commodore

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