Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field Defaults

Status
Not open for further replies.

madvalpreston

Technical User
Apr 7, 2011
142
GB
Hi

I have a table with 3 field that hold prices and I am using an Access front end. The prices are working ok, but I now need to have a default value in them of 0.00 (£0.00)

Column Name Datatype
Budgetprice Decimal(10,0)
Reportprice Decimal(10,0)
Totalprice Decimal(10,0)

In the default part of the field I tired adding 0.00 and it changed it to 0. But this does not work.

Could someone advise how I set the default for these 3 fields to £0.00

Thanks
 
What do you mean that "0 does not work"? Did the default setting fail to make the value 0 in a new row, or are you trying to format the result 0 to 0.00? You can use the Format property in Access to make 0 look like 0.00. MySQL will just store the value as required to get the precision specified, so 0 is always correct regardless of the precision or scale.
 
Hi

Thanks for the reply.

The default setting did not make the 0 in the new row.

If I use access format settings it gives #error messages, so I tried using Mysql default, but does not update the new row...

Any ideas

Thanks
 
Hi Simon

Not sure how to post a table definition, please advise. (Fairly new to MySql)

For now I ahve set the dafult within the form in Access and strangely it works now, but just as 0 and not with £0.00

Thanks
 
I've just noticed that your column definitions specify
Code:
Column Name         Datatype
Budgetprice         Decimal(10,0)
Reportprice         Decimal(10,0)
Totalprice          Decimal(10,0)
If you want to store decimals, you need a number bigger than 0 after the comma:
Code:
Column Name         Datatype
Budgetprice         Decimal(10,2)
Reportprice         Decimal(10,2)
Totalprice          Decimal(10,2)
Sorry I was a bit slow there.

Simon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top