Concatenate on a form

J

Jim L.

On a form, a user will enter data into a date control and a time control. I
have hidden controls next to them that reformat the date to read yymmdd, and
the time to read hhmm without the slashes, colons or spaces. How can I
combine these two controls to become a unique report number?
 
A

Arvin Meyer [MVP]

Format([DateField], "yymmdd") & "-" & Format([TimeField], "hhmm")

or the out the "-" altogether. BTW, You can put both in a single textbox and
still format them like the above, using slightly different syntax.
 
J

Jim L.

Thanks Mr. Meyer. I was close, but this worked perfectly.

Arvin Meyer said:
Format([DateField], "yymmdd") & "-" & Format([TimeField], "hhmm")

or the out the "-" altogether. BTW, You can put both in a single textbox and
still format them like the above, using slightly different syntax.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Jim L. said:
On a form, a user will enter data into a date control and a time control.
I
have hidden controls next to them that reformat the date to read yymmdd,
and
the time to read hhmm without the slashes, colons or spaces. How can I
combine these two controls to become a unique report number?
 
D

Douglas J. Steele

For that matter, you could also use

Format([DateField] + [TimeField], "yymmdd-hhnn")

or

Format([DateField] + [TimeField], "yymmdd hhnn")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Arvin Meyer said:
Format([DateField], "yymmdd") & "-" & Format([TimeField], "hhmm")

or the out the "-" altogether. BTW, You can put both in a single textbox
and still format them like the above, using slightly different syntax.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Jim L. said:
On a form, a user will enter data into a date control and a time control.
I
have hidden controls next to them that reformat the date to read yymmdd,
and
the time to read hhmm without the slashes, colons or spaces. How can I
combine these two controls to become a unique report number?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top