Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to set default Number format for Table fields?

    Is there a way to set the format for fields of datatype "number" in a table to be "standard" w/o having to set the format in the properties list individually for each number field ?

    Thanks

    Bill M

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to set default Number format for Table fields?

    Do you want to set "Standard" as default format for new numeric fields that you create? I don't know of a way to do that.

    Once you have created a numeric field and set its properties, you can duplicate it by copy & paste.

    It would be possible to create a VBA procedure to set the number format to "Standard" for all numeric fields in a table to be specified, or in all tables in a database. This is not what you asked, but if you're interested, post back.

  3. #3
    New Lounger
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to set default Number format for Table fie

    Yex: I am looking for a way to set the default for new numeric fields in a table.

    Given that there (may not be) (is not) a way to do this I would be interested in the essence of what a VBA procedure would look like to set the format property for numeric fields in a table.

    (I'm somewhat of a novice in Access VBA; Looking in Help at the properties for a DOA field object I don't see anything for "Format" so I'm sure I don't really quite understand how this works).

    Thanks

    Bill M.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to set default Number format for Table fie

    I have attached the code as a text file. Copy the text to a general module. It uses DAO. You haven't mentioned which version of Access you use. In Access 97 (and earlier versions), DAO is the default data model, so there will be a reference to the DAO object library. In Access 2000 and 2002, you must set the reference yourself:
    <UL><LI>Activate the Visual Basic Editor (Alt+F11).
    <LI>Select Tools | References...
    <LI>Locate the Microsoft DAO 3.6 Object Library in the list and check the corresponding box.
    <LI>Click OK.[/list]The code consists of three procedures:

    SetFieldFormat is not to be used by itself, it is called by the other two procedures.

    SetFormatInOneTable sets the number format for all numeric fields to Standard in the table specified as argument. Call it like this:

    SetFormatInOneTable "tblTest"

    SetFormatInAllTables sets the number format for all numeric fields to Standard in all tables in the database. It takes no arguments:

    SetFormatInAllTables

    I hope that you can use this.
    Attached Files Attached Files

  5. #5
    New Lounger
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to set default Number format for Table fie

    Perfect ! It will do just what I need....

    Thanks again

    Bill M

Posting Permissions

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