[AccessD] Create table script...so close...

paul.hartland at fsmail.net paul.hartland at fsmail.net
Thu Apr 1 08:14:51 CST 2004


Just a thought have you tried dbText instead:
arrFileLayout(y, 6) contains the field type (=dbText)
Paul






Message date : Apr 01 2004, 02:57 PM
>From : "S D" 
To : "accessd" 
Copy to : 
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
Freeserve AnyTime - HALF PRICE for the first 3 months - Save £7.50 a month 
www.freeserve.com/anytime


More information about the AccessD mailing list