Results 1 to 2 of 2

Thread: SQL Guru needed! (should be easy)

  1. #1

    Thread Starter
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    DAO Example - I dont think you can do this with the ALTER TABLE Statement...

    Code:
    Sub ZeroLengthField()
        Dim dbs As Database, tdf As TableDef, fld As Field
    
        ' Return reference to current database.
        Set dbs = CurrentDb
        ' Return reference to Employees table.
        Set tdf = dbs.TableDefs!Employees
        ' Create new field in Employees table.
        Set fld = tdf.CreateField("SpouseName", dbText, 15)
        ' Allow zero-length strings in field.
        fld.AllowZeroLength = True
        ' Append Field object.
        tdf.fields.Append fld
        Set dbs = Nothing
    End Sub
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  2. #2
    Addicted Member P.S.W.'s Avatar
    Join Date
    Aug 2000
    Posts
    146

    Talking

    Works great, thanks Crispin!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width