Convert hours to decimals on a form

G

Guest

Hello, I want to add a pop up form to some of my text boxes on my frmMaindB
that will bring up a conversion chart if double clicked on. On this form I
need two text boxes and a close button I want to be able to enter minutes in
one text box called (txtMinutes) and in the other (named txtDecimal) have it
converted to decimal and on close of the pop up it will put the decimal
answer in the text box on my frmMaindB. Example: 480 in the top text box
(txtMinutes) and it would generate in the bottom text box (txtDecimal) 8.00.
any Ideas? Thanks!
 
J

John W. Vinson

Hello, I want to add a pop up form to some of my text boxes on my frmMaindB
that will bring up a conversion chart if double clicked on. On this form I
need two text boxes and a close button I want to be able to enter minutes in
one text box called (txtMinutes) and in the other (named txtDecimal) have it
converted to decimal and on close of the pop up it will put the decimal
answer in the text box on my frmMaindB. Example: 480 in the top text box
(txtMinutes) and it would generate in the bottom text box (txtDecimal) 8.00.
any Ideas? Thanks!

txtDecimal should NOT be a bound textbox, since its value depends on another
field. Instead just set its control source to

=Round([txtMinutes] / 60, 2)

Or... if txtMinutes is unbound and txtDecimal is the only bound control, use
this same expression in the AfterUpdate event of txtMinutes:

Private Sub txtMinutes_AfterUpdate()
Me!txtDecimal = Round(Me!txtMinutes / 60, 2)
End Sub

John W. Vinson [MVP]
 
G

Guest

john, How do I get it to update the decimal without having to click out of
the minutes text box?

John W. Vinson said:
Hello, I want to add a pop up form to some of my text boxes on my frmMaindB
that will bring up a conversion chart if double clicked on. On this form I
need two text boxes and a close button I want to be able to enter minutes in
one text box called (txtMinutes) and in the other (named txtDecimal) have it
converted to decimal and on close of the pop up it will put the decimal
answer in the text box on my frmMaindB. Example: 480 in the top text box
(txtMinutes) and it would generate in the bottom text box (txtDecimal) 8.00.
any Ideas? Thanks!

txtDecimal should NOT be a bound textbox, since its value depends on another
field. Instead just set its control source to

=Round([txtMinutes] / 60, 2)

Or... if txtMinutes is unbound and txtDecimal is the only bound control, use
this same expression in the AfterUpdate event of txtMinutes:

Private Sub txtMinutes_AfterUpdate()
Me!txtDecimal = Round(Me!txtMinutes / 60, 2)
End Sub

John W. Vinson [MVP]
 
J

John W. Vinson

john, How do I get it to update the decimal without having to click out of
the minutes text box?

When do you *want* it to update? Access cannot telepathically determine that
when the user has typed 48 that they're done... and that they won't type a 0
in the next 100 milliseconds (or after coming back from lunch!)

You need some way - such as tabbing, hitting enter, or clicking elsewhere - to
tell Access that you're done with entry. Can't the user just press the Enter
key?

John W. Vinson [MVP]
 
G

Guest

John, I just added a button next to it that said calculate and the button
does nothing. Ok, This is only paert one of my question though. I want to be
able to double click on one of my 4 text boxes thats going to use this pop up
and have the pop up open. Then enter the information into the minutes and
click the calucate button that doesnt mean nothing to get the number. Then I
have added a button at the bottome of the pop up that has this code to close
the pop up and put the info from the txtDecimals into the text that I double
clicked into. I can only figure out how to get it work on one text box on my
frmMaindB. Here is the return code im using in the on click cmd button for
one text box to return the decimal data to the text box. Thanks!

Forms!frmMaindB!txtDTRegular = Me.txtDecimal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top