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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert number's into text?

Status
Not open for further replies.

UAMI

Programmer
Dec 10, 2003
28
PT
I want to do a select statement where i want to concatenate 4 fields, 3 are numbers and 1 text.
year (number)
month (number)
sequence (number)
flag (text)



How can i transform a numbers into a character?

In this file i can have many records with the same key (the 4 fields) but i want to select only the first record of the same key. How can i done this??


Thank's in advance

 
I'm not sure if this is what you mean?

Select distinct (cstr(year) & Cstr(month)& Cstr(sequence)& flag ) as MyKey from mytable

 
If you're working in VB code then you can use the string concatenation operator "&"

Eg

txtResult = year & month & sequence & flag

Will give today as

20040630xxxx ( or whatever flag actually contains )

this works is because VB does its best to be 'helpful' in converting data types automatically.


Otherwise use the convert to string function CStr(number)






G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Hi,

You have to pad with zeros otherwise how can you differentiate between 1/11/2004 and 11/1/2004
[tt]
Select IIF(Month([MyDate])<10,"0",""))&CStr(Month([MyDate])).....

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
I'm doing this statement in the query's of Microsoft Access. I think that i can's do it with string function CStr(number)




 
why not?

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top