Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenating two Time fields

Status
Not open for further replies.

NeedsHelp101

Technical User
Jul 18, 2006
43
US
Hi,
I'm trying to concatenate two Time fields in a query. Sometimes the second field will be null, so I wrote:
(the lengths are associated with a MasterName)
Code:
Duration: Format([tblMasterNames.Length],"Short Time") & ("/"+Format([tblMasterNames_1.Length],"Short Time"))

and in SQL:
Format([tblMasterNames.Length],"Short Time") & ("/"+Format([tblMasterNames_1.Length],"Short Time")) AS Duration
OR
Code:
Duration1: IIf([tblISCI].[Master2]=Null,Format([tblMasterNames.Length],"Short Time"),Format([tblMasterNames.Length],"Short Time") & " / " & Format([tblMasterNames_1.Length],"Short Time"))

and in SQL:
 IIf([tblISCI].[Master2]=Null,Format([tblMasterNames.Length],"Short Time"),Format([tblMasterNames.Length],"Short Time") & " / " & Format([tblMasterNames_1.Length],"Short Time")) AS Duration1

No matter what I try, though, if the second field is null,
I will get something like 00:30 /
I need to get rid of the backslash. Can someone help?
Thanks!
 
Don't use
= Null
but
Is Null

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 



Hi,

???

Duration is the difference in two times.

What you seem to be reporting is two time string representations.

So if the two times are 01:00 and 13:30, do you want to report
[tt]
Duration
01:00 / 13:30
[/tt]
???

What does that have to do with Duration?

The Duration is...
[tt]
12:30
[/tt]
which is the ABS(DIFFERNCE) between the two times.

???



Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Hi Skip,
Thanks for the input- I did want to represent the string, because it was the durations of two things that I wanted to put in the column.
PHV solved the problem for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top