473,386 Members | 1,873 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,386 software developers and data experts.

How to convert Date to String

I created a form with the following fields:

ID (AutoNumber)
Date (Date / Time)
Name (Text)

I want to create a query that will take
the first letter of the Name & Date & ID & last digit of the ID.

Thanks,

galsaba

Nov 13 '05 #1
4 83478
Put the following expression in the first field of the query:
MyResult:Left([Name],1) & Left([Date],1) & Left([ID],1) & Right([ID],1)

Note that Date and Name are reserved word.s You need to change the names of
those fields.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com


"galsaba" <ga*****@aol.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I created a form with the following fields:

ID (AutoNumber)
Date (Date / Time)
Name (Text)

I want to create a query that will take
the first letter of the Name & Date & ID & last digit of the ID.

Thanks,

galsaba

Nov 13 '05 #2
SELECT (Left([Name], 1) & Format([Date], "yyyymmdd") & Right([ID], 1)
AS MyTextString
FROM MyTableName;

Also, do not use Name or Date as the name of a field. They and many other
words are reserved words in ACCESS, and can create serious confusion for
ACCESS and Jet. See these Knowledge Base articles for more information:

List of reserved words in Access 2002 and Access 2003
http://support.microsoft.com/default...b;en-us;286335

List of Microsoft Jet 4.0 reserved words
http://support.microsoft.com/?id=321266

Special characters that you must avoid when you work with Access
databases
http://support.microsoft.com/?id=826763

--

Ken Snell
<MS ACCESS MVP>

"galsaba" <ga*****@aol.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I created a form with the following fields:

ID (AutoNumber)
Date (Date / Time)
Name (Text)

I want to create a query that will take
the first letter of the Name & Date & ID & last digit of the ID.

Thanks,

galsaba

Nov 13 '05 #3
it did not give me the reulst.
If the name is Galsaba
and the date is 2/10/05
and the id is 1234

the result should be
G0210054

Thanks

Galsaba

Nov 13 '05 #4
Then change the format argument used in Format to give you the desired
"date" format in the string (I used "yyyymmdd" as an example format):

SELECT (Left([Name], 1) & Format([Date], "mmddyy") & Right([ID], 1)
AS MyTextString
FROM MyTableName;

The above assumes that "02/10/05" means February 10, 2005.

--

Ken Snell
<MS ACCESS MVP>
"galsaba" <ga*****@aol.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
it did not give me the reulst.
If the name is Galsaba
and the date is 2/10/05
and the id is 1234

the result should be
G0210054

Thanks

Galsaba

Nov 13 '05 #5

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

Similar topics

2
by: Hector A | last post by:
Hi I'm trying to convert a string that already looks like a date to a date that I can use when I pass it from java to the database. I receive the date in format yyyy-mm-dd and I need it to be a...
2
by: Remi Caron | last post by:
Hi, I took over an Visual Object project (Visual Clipper) in that language there is a function to: Convert a string containing a 32-bit binary date to a date data type. That function is called...
2
by: Franck | last post by:
Hi, 'm gettin mad about date conversion. Here is the point. Got and add-in for Excel which call functions from a web service (on a remote server) The remote server has regional settings...
1
by: ABC | last post by:
How to convert a date string to datetime value with custom date format? e.g. Date String Date Format Result (DateTime value) "05/07/2004" "MM/dd/yyyy" May 7, 2004 "01062005" ...
10
by: Kim Hellan | last post by:
I have a simple string in the format "DD-MM-YY hh:mm:ss", that I need to convert to a DateTime value. I know this is a standard problem, but please don't just link to all the MSDN pages regarding...
1
by: abcabcabc | last post by:
I write an application which can let user define own date format to input, How to convert the date string to date value with end-user defined date format? Example, User Defined Date Format as...
8
by: deepak_kamath_n | last post by:
Hello, I have the following scenario: 1. My application receives the date from another application as a string 2. The other application is running in a different time zone as compared to my...
2
by: Brian Parker | last post by:
I am beginning to work with VB2005.NET and I'm getting some problems with string formatting converting an application from VB6. VB6 code:- sTradeDate = Format(pArray(4,i Record), "mmddyy") ...
3
by: Jef Driesen | last post by:
How can I convert a date string to a number (e.g. a time_t value or a tm struct)? I know about the strptime function, but then I have to know the format string. And that is a problem. I'm trying...
4
by: Tony B | last post by:
I'm looking to convert a string in "dd/MM/yy" format into a date object. How do I go about this ?
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.