473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CONVERT MONTHS NUMBERS TO ALPHA CHARACTERS

PCV
Hi All,
I want to create a custom auto number in a form that looks like
"CRA05001" where "CR" are fixed characters, then "A" should be for
January as "B" for February and so on...(this part will change
depending on the month, "05001" is the year "05" and "001" a sequential
increment. I Know how to get "CR?05001" but I'm stuck on trying to
convert the month number to the alpha characters. Any suggestions?

Thanks in advance. This is a great group.

Nov 13 '05 #1
5 4883
The easiest thing I can think of is to write a function liket his:

Function MonthAlpha(i As Integer) As String
Select Case i
Case 1 : MonthAlpha = "A"
Case 2 : MonthAlpha = "B"
...
Case 12 : MonthAlpha = "L"
End Select
End Function

When you call your routine to increment you autonumber add this to your
call

autonumString = ... & MonthAlpha(Month(yourDate)) & ...

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #2
On 15 Aug 2005 11:25:30 -0700, PCV wrote:
Hi All,
I want to create a custom auto number in a form that looks like
"CRA05001" where "CR" are fixed characters, then "A" should be for
January as "B" for February and so on...(this part will change
depending on the month, "05001" is the year "05" and "001" a sequential
increment. I Know how to get "CR?05001" but I'm stuck on trying to
convert the month number to the alpha characters. Any suggestions?

Thanks in advance. This is a great group.


In VBA?

="CR" & Choose(Month(Date),"A","B", ........ ,"K","L") &
Format(Date,"yy") & etc.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3
PCV
It works GREAT, Rich!!!!!
THANKS A 1000000

Nov 13 '05 #4
On Mon, 15 Aug 2005 18:45:12 GMT, Rich P <rp*****@aol.com> wrote:

Alternatively, taking advantage of the ASCII character set:
Function MonthAlpha(i As Integer) As String
MonthAlpha = Chr(Asc("A")+i-1))
End Function

You could even use this in-line in a query.

-Tom.

The easiest thing I can think of is to write a function liket his:

Function MonthAlpha(i As Integer) As String
Select Case i
Case 1 : MonthAlpha = "A"
Case 2 : MonthAlpha = "B"
...
Case 12 : MonthAlpha = "L"
End Select
End Function

When you call your routine to increment you autonumber add this to your
call

autonumString = ... & MonthAlpha(Month(yourDate)) & ...

Rich

*** Sent via Developersdex http://www.developersdex.com ***


Nov 13 '05 #5
PCV
Now, I been trying to reset the counter's last part "001" to zero when
the month or the year change. Any ideas?

THANKS ALL for your answer.

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: rh0dium | last post by:
Hi All, While I know there is a zillion ways to do this.. What is the most efficient ( in terms of lines of code ) do simply do this. a=1, b=2, c=3 ... z=26 Now if we really want some...
3
by: culley harrelson | last post by:
It seems to me that these values should be the same: select 'lydia eugenia treviño', convert('lydia eugenia treviño' using ascii_to_utf_8); but they seem to be different. What am I missing? ...
3
by: Stewart Allen | last post by:
Hi there I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting...
6
by: Mark C | last post by:
All, Is there such a function that can strip all non alpha ( not between a-z) characters from a string? I have a function that I currently use that will strip one character at a time from a...
20
by: Niyazi | last post by:
Hi all, I have a integer number from 1 to 37000. And I want to create a report in excel that shows in 4 alphanumeric length. Example: I can write the cutomerID from 1 to 9999 as: 1 ---->...
5
by: Bob Homes | last post by:
In VB6, foreground and background colors of controls had to be assigned a single number. If you knew the RGB values for the color, you still had to convert them into the single number accepatable...
22
by: federico_bertola | last post by:
Hi everybody, I have an array of chars that I want to make all lower int Scan(char Search) { char *cPtr; cPtr = strtok (Search," -,."); while (cPtr != NULL) {
6
by: Mark Chimes | last post by:
Hi All, I need to search thru some strings and discard them if they canot be converted to a decimal or interger value. What is the best way to do this? cheers, Mark Chimes
4
by: meendar | last post by:
Hi, I am having a character pointer which contains ascii values. i just want to convert all these ascii values to respective characters and again store it in another character pointer. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.