Converting Text to Number

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to convert Text records to Number within a query. My table is too big
to change the data type in the table itself. Someone told me to use the
expression builder to create this expression:

Expr1: [MasterAvailabilityData]![ActualAvailPlant]*1

This did not work. I need to convert this one field to Number because I
have another expression that is comparing this field with another. It wont
work because they are different data types. Any suggestions?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the convert functions:

CInt(value) - convert the value to integer
CDbl(value) - convert the value to double
CLng(value) - convert the value to long

.... etc. ...

Usage:

If CInt(text_value) = Integer_value Then ...

or

WHERE Double_Column = CDbl(text_value)

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ+zh5IechKqOuFEgEQIgGACfSivbtSetC1L/YaY6nurUzyS2uAUAmQGA
zZmD6tBHvyzMoT90K4nmh6fT
=5RKD
-----END PGP SIGNATURE-----
 
Lucien said:
I want to convert Text records to Number within a query. My table is too big
to change the data type in the table itself. Someone told me to use the
expression builder to create this expression:

Expr1: [MasterAvailabilityData]![ActualAvailPlant]*1

This did not work. I need to convert this one field to Number because I
have another expression that is comparing this field with another. It wont
work because they are different data types.


Not really clear what you really need here. If the field,
ActualAvailPlant really is converable to a number (what kind
of number?), then you can just use:
Expr1: Val(ActualAvailPlant)

But, that's not really necessary. You can just use
Val(ActualAvailPlant) in the comparison or where ever you
really need to use it in an expression.
 
thanks for the help!



Marshall Barton said:
Lucien said:
I want to convert Text records to Number within a query. My table is too big
to change the data type in the table itself. Someone told me to use the
expression builder to create this expression:

Expr1: [MasterAvailabilityData]![ActualAvailPlant]*1

This did not work. I need to convert this one field to Number because I
have another expression that is comparing this field with another. It wont
work because they are different data types.


Not really clear what you really need here. If the field,
ActualAvailPlant really is converable to a number (what kind
of number?), then you can just use:
Expr1: Val(ActualAvailPlant)

But, that's not really necessary. You can just use
Val(ActualAvailPlant) in the comparison or where ever you
really need to use it in an expression.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top