Solved

Copy formatted date/time value to a 2nd form

Posted on 2014-04-21
5
288 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Export  Access Query To Excell 16 47
Access query with left expression 9 31
Acc 2010 pause execution 10 9
Access database form in matrix view 14 14
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

920 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

15 Experts available now in Live!

Get 1:1 Help Now