If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
how can I store short dates numbers only no slashes
I am triing to concatenate parts of cells to create ID numbers but the Date
of Birth stores slashes and puts them into my ID numbers |
#2
|
|||
|
|||
how can I store short dates numbers only no slashes
See VBA Help on the Month, Day, and Year functions. They return variants
(integers) representing the component part of the date. If YourDate = 12/13/2005 Month(YourDate) returns 12. Sprinks "eleeiv" wrote: I am triing to concatenate parts of cells to create ID numbers but the Date of Birth stores slashes and puts them into my ID numbers |
#3
|
|||
|
|||
how can I store short dates numbers only no slashes
eleeiv wrote:
I am triing to concatenate parts of cells to create ID numbers but the Date of Birth stores slashes and puts them into my ID numbers The slashes aren't being stored, they are part of the display (based on regional settings) If you're trying to extract individual parts of the date to use in a string ID or long ID, you're going to need to use the DatePart function Example: Dim intMonth as Integer Dim intDay as Integer Dim intYear as Integer Dim strNewID as String intMonth = DatePart("m", [YourBirthdayField]) intDay = DatePart("d", [YourBirthdayField]) intYear = DatePart("yyyy", [YourBirthdayField]) strNewID = "ID" & CStr(intMonth) & CStr(intDay) & Cstr(intYear) ' The result of strNewID would be 'ID04272006' if you ran this today -- -D Duncan Bachen Director of I.T., Ole Hansen and Sons, Inc. |
#4
|
|||
|
|||
how can I store short dates numbers only no slashes
On Thu, 27 Apr 2006 12:11:02 -0700, eleeiv
wrote: I am triing to concatenate parts of cells to create ID numbers but the Date of Birth stores slashes and puts them into my ID numbers I'd step back and reconsider. Birthdates are not unique; many people were born on May 16, 1946. Quite a few of them probably have the initials JWV. Building an "Intelligent Key" such as jwv05161946 will be possible, but a fair bit of work - and you have NO guarantee that it will be unique or appropriate! As a rule, one should NOT store multiple pieces of information in one field. It's just a bad idea for many reasons. John W. Vinson[MVP] |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Show dates if multiple Serail numbers are equal | Dark_Templar | General Discussion | 6 | April 8th, 2006 06:09 AM |
prevent converting numbers with hyphens to dates | Mike | General Discussion | 5 | January 27th, 2006 08:41 PM |
numbers changing to dates | technotronic | General Discussion | 6 | January 18th, 2006 05:50 AM |
reversing numbers to create dates | Gilles Desjardins | Worksheet Functions | 5 | October 4th, 2005 11:33 PM |
prevent Excel from EVERautomatically converting numbers to dates | gt | Worksheet Functions | 1 | December 9th, 2003 10:01 PM |