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

Programatically changing field data type..

Status
Not open for further replies.

asenft

Programmer
Apr 24, 2001
52
US
Is there a way to programatically change the field data type? I need to change a field data type from integer to single. Any ideas?

Thanks.
 
If it is not a permanent thing then just make a query with a call to a function to use the conversion routine below. If it is a permanent change use the Table designer to make the change. Remember, you lose precision so any number above the MAX_SINGLE_SIZE could not be converted.

Public Function ConvertInt2Sng(i As Integer) As Single

Dim s As Single
Const MAX_SINGLE_SIZE As Integer = ???
If i <= MAX_SINGLE_SIZE Then
s = CSng(i)
Else
s = null
End If
ConvertInt2Sng = s

Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top