Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Apr 2001
    Location
    KY USA
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Programmatically Setting Default Values (97 SR-2 on Win NT 4.0)

    I have built a module that will copy a "bare-bones" empty table, then add fields to it based on fields created in a crosstab query. In that, I then have a table that has several fields created on the fly. Is it possible to set the default value to the new fields I've added? I did not find it in "Attributes", and I'm not sure where else to look.

    Thanx

    Jeff

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Programmatically Setting Default Values (97 SR-2 on Win NT 4.0)

    Hi Jeff,
    Fields have a DefaultValue property which you can set - it's just Field.DefaultValue rather than being one of the Field.Attributes.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Lounger
    Join Date
    Apr 2001
    Location
    KY USA
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Programmatically Setting Default Values (97 SR-2 on Win NT 4.0)

    Set fld = TDFTest.CreateField(qdfField.Fields(2).NAME, dbText, 11)
    fld.DefaultValue = 0
    TDFTest.Fields.Append fld

    HEY MOE! IT WOIKS! Nyuk Nyuk Nyuk.

    Thanks much.

Posting Permissions

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