Click to See Complete Forum and Search --> : Creating MS Access Table
Traiken
02-25-2009, 01:37 PM
Hey, just wondering how you make a table for a MS Access Database? Don't need connection help or anything, just a small code for creating a table. Oh and also, if possible, any chance of a delete table code and also ideas on how to make a scheduled delete at a certain date? Thanks!
nbcrockett
02-25-2009, 11:58 PM
Here's a few things you can try. I haven't tested it, but it should get you started.
Add Table Select Statement:
strSelect = "SELECT 45 AS Field1, 65 AS Field2 INTO tblTest"
DBConn.Execute strSelect
Delete Table Select Statement:
strSelect = "DROP TABLE tblTest"
DBConn.Execute strSelect
As for running something on a schedule I've read that you can use Windows Scheduled Tasks for this. Here's what I found in a book, but I haven't had a chance to test it.
Microsoft Access Data Analysis
By Michael Alexander
ISBN # 0-7645-9978-X
UPC 9-780764-599781
Two ways to run a scheduled event.
1. Use Windows Task Scheduler to open an Access db that has an AutoExec macro.
2. Create a batch file and run it using Windows Task Scheduler.
Sample Batch File:
"C:\Program Files\Microsoft Office\Office\msaccess.exe"
"C:\Data\DB1.mdb" /Excl /X STATS
Other Options Used in Command Line:
/excl - opens db exclusively
/ro - opens db read-only
/user - starts access using specified username
/pwd - starts access using specified password
/profile - starts access using the options in the specified user profile
/compact - compacts & repairs
/X MacroName - starts db and runs specified macro
/wrkgrp - starts access using specified workgroup info