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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format date and break into 2 lines in Query 1

Status
Not open for further replies.

cimoli

Technical User
Jul 30, 2010
207
US
I am making a datasheet view query whereby I will copy past 1 field to paste into Calendar Creator.
But I have 2 problems. I need (1) to format the TIME in 2 places inside the query calculated field
and (2) break the query into 2 lines in datasheet view to allow a nice copy paste into cal creator.

Here is the query calculated field. Notice the word "Break here":
CalCreator: [DateIn] & " " & "Depart " & [DepartureCityIn] & " at " & [TimeIn] & " - Arrive " & [DestinationCityIn] & " at " & [ArriveIn] & " BREAK HERE " & [DateOut] & " " & "Depart " & [DepartureCityOut] & " at " & [TimeOut] & " - Arrive " & [DestinationCityOut] & " at " & [ArriveOut]

I would like the answer to look like this for each field line. In other words, both lines below are really in the SAME
query field. Just wrapping around like below.

3/19/2013 Depart CLEVELAND, OH at 8:30:00 PM - Arrive BILOXI, MS at 9:45:00 PM
3/22/2013 Depart BILOXI, MS at 1:00:00 PM - Arrive CLEVELAND, OH at 4:15:00 PM

I don't know how to make the line wrap around.
Also don't know how to take off the seconds in the time fields. Just want 8:30 pm and not 8:30:00 pm.

Thanks you for your help.
 
Try a combination of Chr(10) and/or Chr(13)

Replace this:
[TimeIn]
with this:
Format([TimeIn],"hh:nn")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks so much PHV. You solved the time issue. I went with Medium time.

CalCreator: [DateIn] & " " & "Depart " & [DepartureCityIn] & " at " & Format([TimeIn],"Medium Time") & " - Arrive " & [DestinationCityIn] & " at " & Format([ArriveIn],"Medium Time") & " BREAK HERE " & [DateOut] & " " & "Depart " & [DepartureCityOut] & " at " & Format([TimeOut],"Medium Time") & " - Arrive " & [DestinationCityOut] & " at " & Format([ArriveOut],"Medium Time")

The only issue now is how to "break" into 2 lines inside the same query field when i run the datasheet view.
That would enable me to copy paste into calendar creator. I am looking for a datasheet view as below.
(i have the words BREAK HERE in the query only to show you where it should wrap.)

3/19/2013 Depart CLEVELAND, OH at 08:30 PM - Arrive BILOXI, MS at 09:45 PM
3/22/2013 Depart BILOXI, MS at 01:00 PM - Arrive CLEVELAND, OH at 04:15 PM

Can this be done?
Thanks alot.
 
Again, try a combination of Chr(13) and/or Chr(10)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I forgot that you mention that. The CHR's worked great.

CalCreator: [DateIn] & " " & "Depart " & [DepartureCityIn] & " at " & Format([TimeIn],"Medium Time") & " - Arrive " & [DestinationCityIn] & " at " & Format([ArriveIn],"Medium Time") & Chr(13) & Chr(10) & [DateOut] & " " & "Depart " & [DepartureCityOut] & " at " & Format([TimeOut],"Medium Time") & " - Arrive " & [DestinationCityOut] & " at " & Format([ArriveOut],"Medium Time")

I get what i needed...... The below is all in the datasheet view 1 field for each trip.
I copy paste the 2 lines into calendar creator instead of retyping.

3/19/2013 Depart CLEVELAND, OH at 08:30 PM - Arrive BILOXI, MS at 09:45 PM
3/22/2013 Depart BILOXI, MS at 01:00 PM - Arrive CLEVELAND, OH at 04:15 PM

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top