Conversion in Queries

vbjohn

Registered User.
Local time
Today, 03:38
Joined
Mar 22, 2002
Messages
75
Is there a way to make a string field into a value field in a query?


John-
 
I think it is Val rather than CStr. Doesn't CStr convert to a string? Alternatively there is CInt, CLng and CDbl.
 
Last edited:
Yes your correct Fiz, I've never had to convert strings, but You should use the data-type conversion functions instead of Val to provide internationally aware conversions from one data type to another. According to Help
 
VAL works but watch out for cases where international differences occur.

For instance, what are your decimal and grouping punctuation markers for single or double greater than 1000 with fractional parts?

For integers, VAL is acceptable. But from a documentation & readability viewpoint, you leave out valuable information for posterity. Like, using CInt means you think the item will be limited to integer range but CLng means that bigger numbers could occur. VAL doesn't do any type of checking (other than that you have a valid number.)
 

Users who are viewing this thread

Back
Top Bottom