Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

concatenation problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rich - 17 Apr 2008 21:08 GMT
The following data is output from our production control program :
   Log-in times on the floor are split between 2 fields; [Beg Hour]
and [Beg Min] (both number formatted). The problem is, if someone logs
in @ 14:02, the [Beg Min] field records just a "2", so when I
concatenate the two fields, I get 14:2. Being a number field, [Beg
Min] won't recognize a leading zero when I try to add one, and
obviously, this is only an issue when [Beg Min] <=9.
   What is the easiest way to achieve my goal of ending up with one
field, that in the above circumstance would read 14:02, AND be in the
proper Date/Time format for comparison with other date/time fields?
Thanks in advance to all who reply.
Rich
Klatuu - 17 Apr 2008 21:25 GMT
Format([Beg Hour], "00\:") & Format([Beg Min], "00")
Signature

Dave Hargis, Microsoft Access MVP

> The following data is output from our production control program :
>     Log-in times on the floor are split between 2 fields; [Beg Hour]
[quoted text clipped - 8 lines]
> Thanks in advance to all who reply.
> Rich
John Spencer - 17 Apr 2008 23:25 GMT
Which will be a text value.  If you need to compare this to values in a
datetime field, you will probably need to wrap the expression in the
timevalue function.

OR use CDate on the string

Or use this expression

CDate((60*[Beg hour] + [Beg Min])/1440)

'====================================================
 John Spencer
 Access MVP 2002-2005, 2007
 Center for Health Program Development and Management
 University of Maryland Baltimore County
'====================================================

> Format([Beg Hour], "00\:") & Format([Beg Min], "00")
Klatuu - 17 Apr 2008 23:32 GMT
Thanks, John, I forgot about the last bit
Signature

Dave Hargis, Microsoft Access MVP

> Which will be a text value.  If you need to compare this to values in a
> datetime field, you will probably need to wrap the expression in the
[quoted text clipped - 14 lines]
>
> > Format([Beg Hour], "00\:") & Format([Beg Min], "00")
John W. Vinson/MVP - 18 Apr 2008 02:29 GMT
>    What is the easiest way to achieve my goal of ending up with one
> field, that in the above circumstance would read 14:02, AND be in the
> proper Date/Time format for comparison with other date/time fields?

TimeSerial([Beg Hour], [Beg Min], 0)

will do it in one shot...
John Spencer - 18 Apr 2008 16:01 GMT
Dang!  I forgot all about TimeSerial.

'====================================================
 John Spencer
 Access MVP 2002-2005, 2007
 Center for Health Program Development and Management
 University of Maryland Baltimore County
'====================================================

>>    What is the easiest way to achieve my goal of ending up with one
>> field, that in the above circumstance would read 14:02, AND be in the
[quoted text clipped - 3 lines]
>
> will do it in one shot...
Rich - 18 Apr 2008 16:07 GMT
On Apr 17, 9:29 pm, "John W. Vinson/MVP"
<please.re...@to.the.newsgroup> wrote:
> >    What is the easiest way to achieve my goal of ending up with one
> > field, that in the above circumstance would read 14:02, AND be in the
[quoted text clipped - 3 lines]
>
> will do it in one shot...

Thanks to all who responded. As usual, the answers you all provided
were outstanding.
Rich
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.