Re: Use VBA to set Format Property of a Field

D

Douglas J. Steele

The Format property is a String, not a Currency.

Try:

Set prop = fld.CreateProperty("Format", dbText, "Fixed")
 
D

Douglas J. Steele

If you've got references set to both ADO and DAO, try being explicit in your
declaration"

Dim fld As DAO.Field
Dim prop As DAO.Property

Field and Property are objects in both models, and since you're using DAO in
your code, it's critical that they be instantiated as the correct type.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


rwboyden via AccessMonster.com said:
Douglas said:
The Format property is a String, not a Currency.

Try:

Set prop = fld.CreateProperty("Format", dbText, "Fixed")
I need to create a field using VBA which will display with 2 decimal
places.
[quoted text clipped - 24 lines]
' Append the field to the table
tdf.Fields.Append fld

Very logical ... tried this and got an "invalid operation" error on the
"Append.fld" line.
The Format property is "read only" ... is there a way around this or is
there a set of
VBA-assignable specs which would give me the the 2 decimal place format?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top