473,883 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4943
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(Mont h(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(Da te),"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.co m> 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

autonumStrin g = ... & MonthAlpha(Mont h(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
21922
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 bonus points.. a=1, b=2, c=3 ... z=26 aa=27 ab=28 etc..
3
3627
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? culley ---------------------------(end of broadcast)---------------------------
3
3285
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 query should find every machine that has that part number between the serial number range. The problem is that the serial number stored is a text field and the results are not what they should be.
6
9101
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 string that I tried tweaking without success. Any help would be much appreciated. Thanks in advance, Mark C. hereinde@yahoo.com
20
3457
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 ----> 0001 2 ----> 0002
5
8663
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 to the VB6 controls. In VB.NET, you can't set colors that way anymore, now you have to use a "color". There is a way to convert RGB values to a "color", using the Color.FromARGB method. But there doens't seem to be a way to convert the old...
22
18225
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
3974
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
25081
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. Anybody please help in c language. Thanks in Advance.
0
9945
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11160
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10766
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9588
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7978
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7136
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6007
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4622
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.