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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to change data type to Currency 1

Status
Not open for further replies.

Fozzy9767

Technical User
Joined
Jun 12, 2006
Messages
58
Location
US
I tried to do this in the make table query, and while it displays as currency, the field data type is text. I have 4 problem fields that are created while wrapped in FormatCurrency().
Table is MerchantSettlementPage1, Fields are SPS, Gift, MonMin and Fee. I know I can go manually change the data type, but I'd prefer to create the table with the correct data type, or as a second choice, be able to automate the change as a separate process. Any help would be appreciated.

Ken
 
Use the CCur function in your make table query, instead of the FormatCurrency function.
 
FormatCurrency (or any Format function) will always return a text data type. You can create a numeric data type in a MAKE TABLE with something like
Code:
Select Val(Format([CurrencyField],"0.00")) As CurField
but that will probably be typed as single or double rather than currency. Probably the easiest thing to do is use the above to create a numeric field and then
Code:
ALTER TABLE myTable ALTER COLUMN CurField Currency
after you have created the table
 
Thanks rjoubert, that worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top