Solved

Copy formatted date/time value to a 2nd form

Posted on 2014-04-21
5
287 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
  • 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 49

Accepted Solution

by:
Gustav Brock earned 500 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 49

Expert Comment

by:Gustav Brock
ID: 40014670
You are welcome!

/gustav
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now