Rabu, 28 Oktober 2015

Re: [MS_AccessPros] Re: Returning alphabet "a"

 

here is some code I wrote to get column letters for Excel ...

if there are more than 26 values, it will then return AA, AB, ... AZ, BA, BB, ...

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function GetColumnLetter(pCol As Long) As String
'130116 strive4peace
   If pCol <= 26 Then
      GetColumnLetter = Chr(pCol + 64)
   Else
      GetColumnLetter = Chr(Int((pCol - 1) / 26) + 64) _
         & Chr(((pCol - 1) Mod 26) + 65)
   End If
End Function
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if lowercase is desired, the return value could be wrapped with LCase

warm regards,
crystal

~ have an awesome day ~


On 10/28/2015 12:37 PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] wrote:
Crystal,
 
I have used this many times but it's still a bit easier coding without converting, incrementing, and converting. I also have concerns about upper and lowercase values having different CHR() values, differences in languages, and what happens if there is a need for more than 26 sequence values.
 
Duane Hookom, MVP
MS Access
 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Wed, 28 Oct 2015 10:20:15 -0600
Subject: Re: [MS_AccessPros] Re: Returning alphabet "a"



chr(97) is "a"

On 10/28/2015 8:42 AM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] wrote:
It seems that a lot of the previous replies have not been included in your reply. Could you provide the significant table and field names as well as some sample data?
 
Do you really need to use a, b, c, ... or would 1, 2, 3,... work (it's easier to code).
 
Duane Hookom, MVP
MS Access
 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Wed, 28 Oct 2015 12:10:13 +0800
Subject: Re:RE: [MS_AccessPros] Re: Returning alphabet "a"

Duane,
The sequence is the PartID.
Best Regards,
Kevin



在 "Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>,2015 年10月28日 上午11:48写道:



 
Kevin,
You haven't provided any field or fields that determine the sequence of the different services so you may be stuck manually entering a, b, c,...

Duane Hookom, MVP
MS Access


To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Wed, 28 Oct 2015 07:16:29 +0800
Subject: Re:[MS_AccessPros] Re: Returning alphabet "a"

Bill-
I realized it. The reason I want an alphabet appearing automatically is that I want to divide a long travel Itinerary into parts according to different services booked, e.g.     air ticket, coach, etc. So with the alphabet I can name the parts as a,b,c...etc. Is that possible to get this done? Thank you Bill.
Best Regards,
Kevin



"wrmosca@comcast.net [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>,2015 年10月28日 上午12:30写道:



 
Kevin

Perhaps you should clarify what business rule you are needing? One thing to keep in mind...double-click also triggers a single click event if one exists.












__._,_.___

Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (11)

.

__,_._,___

Tidak ada komentar:

Posting Komentar