By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,341 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

How to convert Date to String

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.