A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

change to standard format



 
 
Thread Tools Display Modes
  #1  
Old January 29th, 2006, 04:44 PM
accessman2 accessman2 is offline
Member
 
First recorded activity by OfficeFrustration: Dec 2005
Posts: 4
Default change to standard format

Set tbl = db.TableDefs("Invoice")

tbl.Fields.Append tbl.CreateField("amount", dbCurrency)

the above code is working well.
However, the below code, I cannot change the format (standard), no dollar sign.

tbl.Fields("amount").Properties("Format") = "Standard"

The message said that "property no found"
What's wrong with it?
How can I change the format (standard)?
Please let me know, thanks.
  #2  
Old January 30th, 2006, 12:26 AM posted to microsoft.public.access.tablesdbdesign
external usenet poster
 
Posts: n/a
Default change to standard format

Not all properties are created when a field is created: some are only
created when they're required.

Try the following:

Dim fld As DAO.Field
Dim prp As DAO.Property

Set tbl = db.TableDefs("Invoice")
Set fld = tbl.CreateField("amount", dbCurrency)
Set prp = fld.CreateProperty("Format", dbText, "Standard")
fld.Properties.Append prp
tbl.Fields.Append fld


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"accessman2" wrote in message
. ..

Set tbl = db.TableDefs("Invoice")

tbl.Fields.Append tbl.CreateField("amount", dbCurrency)

the above code is working well.
However, the below code, I cannot change the format (standard), no
dollar sign.

tbl.Fields("amount").Properties("Format") = "Standard"

The message said that "property no found"
What's wrong with it?
How can I change the format (standard)?
Please let me know, thanks.


--
accessman2



  #3  
Old January 30th, 2006, 11:33 PM posted to microsoft.public.access.tablesdbdesign
external usenet poster
 
Posts: n/a
Default change to standard format

On Sun, 29 Jan 2006 16:44:49 +0000, accessman2
wrote:


Set tbl = db.TableDefs("Invoice")

tbl.Fields.Append tbl.CreateField("amount", dbCurrency)

the above code is working well.
However, the below code, I cannot change the format (standard), no
dollar sign.

tbl.Fields("amount").Properties("Format") = "Standard"

The message said that "property no found"
What's wrong with it?
How can I change the format (standard)?
Please let me know, thanks.


You may need to add the Format property to the field - if there is
none, it's not there to change.

However, the format of a Table field is - generally - completely
irrelevant. You shouldn't be displaying data in Tables in any case;
and you can easily set the format property of a Form or Report textbox
in which you're displaying the [Amount] field.


John W. Vinson[MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I change a date with no format (20051111) to date format? Rose New Users 2 November 11th, 2005 09:03 PM
format change Terry Charts and Charting 2 November 2nd, 2005 02:11 AM
Change General Format to Currency Format Freshman Worksheet Functions 3 July 8th, 2005 03:42 AM
Change FORMAT viddom General Discussion 1 July 1st, 2005 06:06 PM
email format Lloyd General Discussion 1 June 16th, 2004 03:42 AM


All times are GMT +1. The time now is 06:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.