SQL to ACCESS 
Author Message
 SQL to ACCESS

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"



Tue, 24 Jun 2003 00:35:46 GMT  
 SQL to ACCESS
'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"



Sat, 28 Jun 2003 05:19:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB SQL or ACCESS SQL ?

2. SQL HELP: Access to SQL Server

3. Using SQL To access Access 1.1 Database in VB

4. SQL and Access

5. Table copy from SQL to Access

6. SQL in Access

7. Jet SQL syntax Access 2000

8. SQL in Access

9. Getting date from user to use in a SQL String (Access)

10. Vb.net web page sql server access question

11. SQL multiple Access query

12. sql-server access via visual basic

 

 
Powered by phpBB® Forum Software