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!

Change Field Type in Make-Table Query 1

Status
Not open for further replies.

lifter10

MIS
Dec 3, 2003
45
US
I am running a make-table query and I set up 2 fields where the values are zero. Later I run 2 update queries for these zero valued fields and I get a conversion error. What happens is when the make-table query runs, it sets these two field values to Long Integer. When I run my update query, I need to update with values that are larger than what a Long Integer field can hold.

Bottom line, how can I make these two fields become Single number fields and not Long Integer when I run my make-table query.

Thanks in advance,

Chris
 
The Csng function should help you. This converts a number to single precision.

In your make-table query, you can create an expression using this function.

To forct the initial value of a field to zero, write the expression
Code:
Csng(0)
In fact, I have found that Access will create the field as double-precision (!) but this is close to what you want.

In the same way, if you have an existing field MyIntegerField which you want to copy in the make-table query, write the expression:
Code:
Csng([MyIntegerField])
This will copy the field into the new table, converting it to double-precision as it goes.

You can always change the fields to single-precision manually, later - I can't see why Access won't make them single precision directly, but hopefully double-precision will allow your other queries to run without problems.


Bob Stubbs
 
Sweet! I don't know why I couldn't think of that, but thanks a lot for the help! I've been stuck on this for a while. Thanks Bob!

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top