Selasa, 07 Juli 2015

Re: [MS_AccessPros] Re: convert text field to number

 

Patty-


Like this:

SELECT Glucose_outside_Lab.person_id, CLng(Glucose_outside_Lab.observ_value) As ObValue, Glucose_outside_Lab.result_code, Glucose_outside_Lab.obs_date_time, Glucose_outside_Lab.person_nbr
FROM Glucose_outside_Lab;

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Jul 7, 2015, at 8:28 PM, pattykf@cox.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

The numbers are really numbers not One hundred


I am just not sure where I put the CLng  in my sql
the query is basic at the moment;

SELECT Glucose_outside_Lab.person_id, Glucose_outside_Lab.observ_value, Glucose_outside_Lab.result_code, Glucose_outside_Lab.obs_date_time, Glucose_outside_Lab.person_nbr
FROM Glucose_outside_Lab;
 

where the observ_value is the field that is text (numbers ranging from 50 to 300), where I would like to convert the text of that field to number
 I gave a couple of stabs at trying to do it but I have not ever done this one before

If you could give me some instructions as to where/what I put to get this to work that would be wonderful
Patty

---In MS_Access_Professionals@yahoogroups.com, <wrmosca@...> wrote :

Patty

Depending on what the numbers are (integers or decimals) all you have to do in most cases is use a built-in function to convert it. Whole numbers like "968" would use CLng or CInt like this:
CLng([myTextNum])

So would be true: CLng("002") < CLng("3")

Decimals would use CDec()

Or are you talking about text like "one hundred"?

Regards,
Bill Mosca, Founder - MS_Access_Professionals
Microsoft Office Access MVP
My nothing-to-do-with-Access blog



---In MS_Access_Professionals@yahoogroups.com, <pattykf@...> wrote :

I have a field that the table unfortunately has numbers in text format

I did a search on converting but just can't find a reasonable answer on how to convert it to text. I am sure there is a simple conversion but I can't find it


I eventually want to be able to query the data for less and greater than values so I need it in number format

thank you

Patty

 

__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

.

__,_._,___

Tidak ada komentar:

Posting Komentar