CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2001
    Posts
    9

    Setting Field Properties for Access table with ADO.

    PLEASE HELP!

    I'm having difficulty with setting the properties of fields with ADO for an Access DB. I have created a new table and the appropriate Fields (names and datatypes), but cannot figure out how to set the properties such as: "Required", "Allow Zero Length", "Indexed", etc. that can be set from within access.

    How can I dynamically tell what properties are available (different datatypes have different properties) , and then set them accordingly.

    ANY help would be much appreciated.

    Thanks.






  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Setting Field Properties for Access table with ADO.

    Dim FlatCat As New ADOX.Catalog

    FlatCat.ActiveConnection = _
    "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=c:\data\mydb.mdb;" 'must use OLEDB.4.0.. not 3.51

    Set objNewColumn = New ADOX.Column
    objNewColumn.Name = "Additional Information"
    objNewColumn.Attributes = adColFixed And Not adColNullable
    objNewColumn.Type = adVarWChar
    objNewColumn.DefinedSize = 30
    objNewTable.Columns.Append objNewColumn
    objNewColumn.Properties("Jet OLEDB:Allow Zero Length").Value = True
    objNewColumn.Properties("Default").Value = """"""


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Jul 2001
    Posts
    9

    Didn't work

    Sorry, I've looked at these methods before, but still haven't found out how to set whether the value of a field is "Required".

    To see the properties I want to set, Open a table in Access in Design mode. Down at the bottom is a list of properties. So far, it seems they can't be changed with VB and ADO.

    PLEASE, someone tell me how to access these properties.

    Thanks again,
    Tony


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

Featured