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!

Tough One: Setting a Field from Long Int To Double

Status
Not open for further replies.

GGleason

Technical User
Mar 22, 2001
321
US
I have an SQL statement that creates a table. There are some numeric fields that are translated as long integers (because they are zeroes) but I want them changed to double. Here is a sample of the code that I am trying to use (errors on red text):
[tt]
Call MakeDouble(tbl.Fields("Length"))


Private Sub MakeDouble(fld As Field)
Dim prp As Property
Set prp = fld.CreateProperty("FieldSize", dbDouble)
[tt]fld.Properties.Append prp[tt]
Set fld = Nothing
Set prp = Nothing
End Sub
[/tt] [/color][/tt]
tia,
GGleason
 
Your statement leaves us to assume a lot. If you want to change a Long value into a Double value you would simply use the function CDbl(YourLongVariable), but you are trying to add a property to a field. That doesn't compute, so the saying goes. Could you go into the table design after the table is created using the script and simply change it to a numeric double? Since you would need to load it with data periodically using the CDbl function.

Steve King Growth follows a healthy professional curiosity
 
Steve,

Thanks for responding. What I am trying to do is change the "FieldSize" property from Long Integer to Double through VBA. So I may be using the wrong approach to do this. I don't know how to tell a table to change its field value from Long Int to Double. Is there a way to do this?

Thanks,
GGleason
 
Steve, you jogged my mind to try something you suggested. In the SQL statement, I would say
[tt]0 As Length [/tt]
Per your suggestion, I did the following:
[tt]CDbl(0) As Length [/tt]
which made the field into a numeric double.

Thanks!
GGleason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top