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

How can you change type of fied in a query, eg. text to number

Status
Not open for further replies.

amy3000

Technical User
Sep 25, 2000
59
US
It's probably convoluted but to do a datediff to determine age, I determine age by days then divide that by 365 and then truncate the number so there are no decimals. The truncated field turns out to be a text field even though the others that were used to determine it are both numbers. Is there a way in a query to change that field from text to number? In my fly by the seat of my pants way, one solution I came up with it to do a make table query and change the type of field in the table design. Thanks.
 
amy3000

Try CInt([Field_Name] or <expression results> here)
or CLng() or CDbl()...

HTH
Todd
 
I tried the expression in the link but couldn't get it to work. However, the CInt([field_name]) did work.
 
If it works and you don't mind some minor in-accuracies than go for it... There aren't 365 days in every year and 365.25 isn't really accurate either.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top