Charlotte Foust
cfoust at infostatsystems.com
Thu Apr 1 10:28:54 CST 2004
When you're using ADO, you have to use ADO datatype enums. Try
adVarChar. TEXT is the data type for memo fields in SQL Server.
Charlotte Foust
-----Original Message-----
From: S D [mailto:accessd667 at yahoo.com]
Sent: Thursday, April 01, 2004 5:54 AM
To: accessd
Subject: [AccessD] Create table script...so close...
Hi group,
I need to create tables using the layout specified in a certain table. I
found the SUB below on msdn.microsoft.com. Changed it a bit and voila
the tables are created! HOWEVER, when i specify TEXT the darn thing
creates MEMO fields?!? Qua Pasa?
Does anybody know how to change this so that I get proper text fields?
BTW: arrFileLayout(y, 6) contains the field type (=TEXT)
BTW2: I also used the actual word TEXT.
TIA,
Sander
Sub CreateTableX1(ByRef arrFileLayout())
Dim dbs As ADODB.Connection ' Database
Dim y As Integer
Dim strCreateTable As String
Dim strCreate As String
Dim strFields As String
Set dbs = CurrentProject.Connection()
' Create a table with two text fields.
strCreate = "CREATE TABLE ThisTable "
For y = 0 To UBound(arrFileLayout, 1)
'Debug.Print (arrFileLayout(y, 0))
strFields = strFields & arrFileLayout(y, 0) & arrFileLayout(y, 6)
& ","
Next y
'remove last ,
strFields = Mid(strFields, 1, Len(strFields) - 1)
Debug.Print strFields
'Build sql
strCreateTable = strCreate & "(" & strFields & ")"
Debug.Print strCreateTable
'execute the blody thing
dbs.Execute strCreateTable
dbs.Close
End Sub
---------------------------------
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway - Enter today
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com