• Set table field format programmatically (Access 97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Set table field format programmatically (Access 97)

    Author
    Topic
    #368563

    I want to create a new table field using ALTER TABLE. “ALTER TABLE tblEmployee ADD Column HavePhoto YesNo;” works just fine, but then how can I get the new field to have a YesNo format as well as the YesNo data type? Since I suspect I might not be able to do this with the ALTER TABLE command, I tried to do it from a form, but couldn’t come up with the proper syntax (or something). Can anyone tell me how to do this?

    Viewing 0 reply threads
    Author
    Replies
    • #577940

      You can’t do it either way. You have to use DAO code to set the properties of the field object. If you’re going to all that trouble, you might as well create the field and set those properties at the same time. Look up “CreateField” in Access on-line help. It includes a sample of code to create a field and append it to a table.

    Viewing 0 reply threads
    Reply To: Set table field format programmatically (Access 97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: