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

S D accessd667 at yahoo.com
Thu Apr 1 07:53:57 CST 2004


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


More information about the AccessD mailing list