Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Copy formatted date/time value to a 2nd form

Posted on 2014-04-21
5
Medium Priority
?
294 Views
Last Modified: 2014-04-22
I have a form which an expert helped me with to format a date/time field as:

SELECT tblLaborTranx.LaborTranxID, tblEmployees.FullName, Format(tblLaborTranx.StartTime,"m/d/yyyy h:nn") AS formattedStartTime, Format([tblLaborTranx].[StopTime],"m/d/yyyy h:nn") AS formattedStopTime
FROM tblLaborTranx LEFT JOIN tblEmployees ON tblLaborTranx.EmployeeID = tblEmployees.EmployeeID
ORDER BY tblEmployees.FullName;

This is working fine.  The date/time now looks like (for example):

4/18/2014 8:28 AM  (with no seconds showing)


But now on the form that this is displaying correctly on I have a command button that when clicked opens a second form.  On this 2nd for is a date/time field that I want to have display the value exactly as I see it from the 1st form.  I have tried this but it doesn't work:

    DoCmd.OpenForm "frmEDITEmployeeLaborTranx", , , "[LaborTranxID]=" & Me.txtRecordID
   
    Forms!frmEDITEmployeeLaborTranx.txtStartTime = Me.txtStart

  I'm getting this instead:

4/18/2014 8:28:03 AM  (with the seconds displaying.  How can I get rid of them?  The field is an unbound field.
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Dulton
ID: 40013121
try this:

  DoCmd.OpenForm "frmEDITEmployeeLaborTranx", , , "[LaborTranxID]=" & Me.txtRecordID
   
    Forms!frmEDITEmployeeLaborTranx.txtStartTime = Format(Me.txtStart,"m/d/yyyy h:nn")
0
 

Author Comment

by:SteveL13
ID: 40013211
That didn't do it.  txtStartTime shows the seconds which I don't want to display.
0
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 40014114
Change the Format property for that unbound textbox to either Standard or: m/d/yyyy h:nn

/gustav
0
 

Author Closing Comment

by:SteveL13
ID: 40014652
This did it.  Thanks.

m/d/yyyy h:nn
0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 40014670
You are welcome!

/gustav
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question