Click to See Complete Forum and Search --> : SQL Create Table - Completely Stumped


greenphoenix
May 2nd, 2007, 12:10 PM
This query is being executed programatically through ADO on an Access 2000 database. When I execute the query in Access itself, it works as it should. When I execute it through my code, I get a syntax error.

CREATE TABLE UsageLog(MNum INTEGER, ReadDate DATE, Reading LONG, Usage LONG)

I'm using VB6 as a development environment, and ActiveX Data Objects version 2.8.

Any help is greatly appreciated.

George1111
May 3rd, 2007, 09:25 AM
Try this syntax


Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabasePath

TableName = "MyTable"

StrSql = "CREATE TABLE " & TableName & _
" ( RecordNum Counter, TransType Char(30), StockCode Char(20))"

Db.Execute StrSql