'for Jet database in Access do somthing like this
Sub CreateSomeTable()
Dim strCreateSQL As String, strInsSQL As String
Dim dbs As DATABASE
strCreateSQL = "CREATE TABLE ae_pds (coldesc text(33), colname text(33)," &
_
"listtable text(9),colvalue text(30))"
'If You want to make primary index on table
'Change strCreateSQL string to something like this
'strCreateSQL = "CREATE TABLE ae_pds (coldesc text(33), colname text(33)," &
_
"listtable text(9),colvalue text(30),CONSTRAINT listtable PRIMARY
KEY(listtable))"
strInsSQL = "Insert into ae_pds (coldesc, colname, listtable)" & _
"select coldesc, colname, listtable from ae_adefs"
'Must set target database
'If create table in current database do
Set dbs = CurrentDb
'If not, open data_database, comment previous row
'Unkoment next row and replace with real path and name
'set
dbs=DBEngine.Workspaces(0).OpenDatabase("c:\Full\Path\to\database_data.mdb")
'See help for OpenDatabase method
'Create
dbs.Execute strCreateSQL
'Insert data
dbs.Execute strInsSQL
' for SQL database use PassThrough query
End Sub
Regards,
Zlatko
Quote:
> Can anybody help me with this sql statement and make compatible with
access.
> I have a program that creates the table both in sql and access depending
on
> the company's choice of database. Thanks in advance.
> "CREATE TABLE ae_pds (coldesc char(33), colname char(33), listtable
char(9),
> colvalue varchar(30)) Insert into ae_pds (coldesc, colname, listtable)
> select coldesc, colname, listtable from ae_adefs"