Use VBA to Create a Select Query

R

richardb

Can someone please help me find (or provide) an example of using VBA in a
module to create a Select Query. I tried searching for this in on-line help
and Microsoft.Com. Right now I can put new sql text into an existing query
(myq.SQL = sqltext), but need to 1) create the query; 2) delete the query
after it has been used. Thank you.
 
R

richardb

Thank you Roger. Your example was complete. Now I need similar help to create
a new table (and delete the table). This operation can make a copy of a
"model" table. I looked at your "Create Table from Linked 2K" but could not
pull out the answer to my basic question. Any further references? Thanks.
 
R

Roger Carlson

Sure. Look for a sample called "DAO.mdb". This is not quite as polished,
but I used it in my database implementation classes. Look at Modules
"Class11" and "Class13". Class11 shows how to create tables with DAO.
Class 13 shows how to do the same thing with SQL data definition statements.
Personally, I prefer SQL.

Let me know if you have any questions.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
R

richardb

Thanks again Roger. I see that "db.TableDefs.Append tblNew" is not required
with the SQL method. I am now reviewing the SQL Constraint clauses in an MS
Language Reference and in your example. I believe I've got this, but am
always frustrated by the absence of an example or two in the MS docs. many
thanks. I've bookmarked your helpful site.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top