[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Capturing minutes and seconds only?

Posted on 2011-02-21
17
Medium Priority
?
289 Views
Last Modified: 2012-05-11
Hi all,

How would I do this?  I have a time field which I have set the format to nn:ss but entering 05:45 becomes 05:45:00 - How do I get around this?  

Regards

Chris
0
Comment
Question by:smods
[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
  • 5
  • 4
  • 3
  • +4
17 Comments
 
LVL 15

Expert Comment

by:Simon Ball
ID: 34941617
enter it as 00:05:45?
0
 
LVL 15

Expert Comment

by:Simon Ball
ID: 34941623
you might need to give more detail?  could you convert your time to just seconds and store it as an integer?
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34941647
Chris,

Try this format:

=Format(Now(),"m:s")

Sincerely,
Ed
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

Author Comment

by:smods
ID: 34941684
Hi guys,

Sorry I wasn't clear! It's for capturing an average transaction time.  If possible I wouldn't want to enter it as 00:05:45

Regards

Chris
0
 
LVL 77

Expert Comment

by:peter57r
ID: 34941720
There isn't any way of entereing just minutes and seconds into a time field.  As you have found , Access will always treat such an entry as hours and minutes.

You can use the technique suggested by Sudonim or you can use two fields, one for minutes and one for seconds and then build the time value in code.

Or you can use the afterupdate event of the entry and rebuild the time using..

me.textboxname= timeserial(0, Hour(me.textboxname), minute(me.textboxname))
0
 

Author Comment

by:smods
ID: 34941747
could you convert your time to just seconds and store it as an integer?

So would I enter the time but in seconds? The two text box solutions doesn't sound ideal.  How would I do this?
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34941780
I am sorry Chris for my first post.

Yeap, I agree with Peter. Date/Time field allows only entry for a day and a time.

If you want to view elapsed time and showing it in minute:seconds then you change the date/time field into a number and enter the elapsed time in seconds. Then, calculate the value into minute:second for display purposes.

Ed

0
 

Author Comment

by:smods
ID: 34941809
Thanks Ed.  How would I do that?

Regards

Chris
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34941887
Chris,

Here it is:

Private Sub t1_AfterUpdate()
Me.MinSec = Me.t1 / 86400
End Sub

t1 = Field name of where you enter the elapsed values in seconds
MinSec = Unbound field that display the minutes:seconds

You need to format the MinSec field with "m:s".

Sincerely,
Ed
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34941929
Replace  Me.MinSec = Me.t1 / 86400 witht the code below instead:


Me.MinSec = Int(Me.t / 60) & ":" & (Me.t - (60 * Int(Me.t / 60)))

Ed
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34941935
Chris,

Pratima's post at ID:34941778 provided the codes I posted above. You can refer that link for more info.

Ed
0
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 34942409
Here is how:

1. Apply an inputmask of:

"00:"00:00

2. Use this code:
Private Sub txtTime_Click()

  If Me!txtTime.SelStart < 3 Then
    Me!txtTime.SelStart = 3
  End If
  Me!txtTime.SelLength = 1
  
End Sub

Private Sub txtTime_Enter()

  Me!txtTime.SelStart = 3
  Me!txtTime.SelLength = 1
  
End Sub

Open in new window


/gustav
0
 
LVL 40

Expert Comment

by:als315
ID: 34942444
Why not to use something like this?
DB26835639.accdb
0
 

Author Closing Comment

by:smods
ID: 34942689
Works like a charm!

Many thanks!!

Chris
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 34942713
You are welcome!

/gustav
0
 
LVL 15

Expert Comment

by:Simon Ball
ID: 34942881
nice work all.
that will teach me to take a long lunch break :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

656 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