Required?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Required?

  1. #1
    Michael Culley Guest

    Required?

    Can anyone tell me if it is possible to change a field from be not required
    to required in code. I wish to do this from VB on an access database. I have
    tried using adox and SQL but I suspect it is not possible without deleting
    the field and adding it back in.

    Thanks

    --
    Michael Culley
    www.vbdotcom.com



  2. #2
    Paul Clement Guest

    Re: Required?

    On Wed, 24 Oct 2001 08:43:57 +1000, "Michael Culley" <mike@vbdotcom.com> wrote:

    Can anyone tell me if it is possible to change a field from be not required
    to required in code. I wish to do this from VB on an access database. I have
    tried using adox and SQL but I suspect it is not possible without deleting
    the field and adding it back in.


    It doesn't appear to be possible with ADOX. Don't know whether this is a bug or simply unsupported.

    It does work with DAO:

    Set db = CurrentDb

    db.TableDefs("NewTable").Fields("Col1").Required = True


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  3. #3
    Michael Culley Guest

    Re: Required?

    Paul,

    Thanks for the reply. Do you know if it is possible with straight SQL?

    --
    Michael Culley
    www.vbdotcom.com


    "Paul Clement" <UseAdddressAtEndofMessage@swspectrum.com> wrote in message
    news:jmgdtt084etcq30t61f3j5hs7btp89c20r@4ax.com...
    > On Wed, 24 Oct 2001 08:43:57 +1000, "Michael Culley" <mike@vbdotcom.com>

    wrote:
    >
    > Can anyone tell me if it is possible to change a field from be not

    required
    > to required in code. I wish to do this from VB on an access database. I

    have
    > tried using adox and SQL but I suspect it is not possible without

    deleting
    > the field and adding it back in.
    >
    >
    > It doesn't appear to be possible with ADOX. Don't know whether this is a

    bug or simply unsupported.
    >
    > It does work with DAO:
    >
    > Set db = CurrentDb
    >
    > db.TableDefs("NewTable").Fields("Col1").Required = True
    >
    >
    > Paul ~~~ pclement@ameritech.net
    > Microsoft MVP (Visual Basic)




  4. #4
    Paul Clement Guest

    Re: Required?

    On Thu, 25 Oct 2001 09:31:31 +1000, "Michael Culley" <mike@vbdotcom.com> wrote:


    Thanks for the reply. Do you know if it is possible with straight SQL?

    I don't believe the ALTER TABLE statement supports manipulation of the Required property. ALTER
    TABLE is rather limited in this respect.


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center