Dixie, if you select a field in table design view, in the lower pane, you
see properties such as:
Field Size
Format
...
Are you attempting to set the Field Size to byte?
Or are you attempting to set the Format property to "General Number"?
If you actually want to change the field size to the Byte data type, you
can't do that with DAO. Instead execute a DDL query statemetn like this:
Dim strSql As String
strSql = "ALTER TABLE tblCommendationsALTER COLUMN [Year] BYTE;"
DBEngine(0)(0).Execute strSql, dbFailOnError
If DDL is new, here is an introduction and some examples:
http://allenbrowne.com/func-DDL.html
For a list of the names ot use with the different libraries, see:
Field type reference - names and values for DDL, DAO, and ADOX
at:
http://allenbrowne.com/ser-49.html
And if you really have a field named "Year", this can cause you grief. You
might want to consider renaming the field (and changing the reference in all
queries, forms, reports, macros and code where the name is used.) For a list
of the field names that cause problems, see:
http://allenbrowne.com/AppIssueBadWord.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Dixie" <di***@dogmail.comwrote in message
news:13*************@corp.supernews.com...
So how do I set a byte size number field to General Number?
dixie
"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:46**********************@per-qv1-newsreader-01.iinet.net.au...
>From memory, the Format property is dbText, not dbByte?
"Dixie" <di***@dogmail.comwrote in message
news:13*************@corp.supernews.com...
>>>I am appending some new fields to a table in vba and when I append a
number field with is a byte, it does not inherit any format. I want it
to be the General Number format, but it is blank. I have tried to change
the format with the following code, but it does not work. What is wrong
with this code and how can I make that byte number field have the General
Number format?
Call
SetPropertyDAO(DBEngine(0)(0).TableDefs("tblComm endations").Fields("Year"),
"Format", dbByte, "General Number")
dixie