B
burl_h
The subs below are each run from 2 command buttons on a form, Machine
Hours and Labour Hours. When the form is initially loaded it is with
Machine hours in the txtMilla thru txtMille text boxes . The operator
can then change from Machine Hours to Labour Hours by clicking the
Labour Hours command button, likewise the operator can change the
Labour Hours back to Machine Hours by clicking the Machine Hours
command button.
I need to overcome the problem of subsequence clicks on the same
command button, for example, if the labour hours were clicked twice one
could never get back to the original value of machine hours when the
machine hours button is clicked.
How would you code these such that after the labour hours command
button is clicked it is somewhat disabled until the machine hours has
been clicked. Or better yet can this be run from the same command
button, as on initial loading of the form it displays Machine Hours in
the text boxes, the command button caption could say Machine hours, but
when pressed it would convert the values in the text boxes to Labour
hours and display Labour Hours in the caption, then obvoiusly on
subsequent clicks it would toggle between the two, but the values
maintain integrity, any thoughts.
Private Sub LabourHours_Click()
Factor = 2.5
MachineHours.Font.Bold = False
LabourHours.Font.Bold = True
frmQuoteForm.txtMilla.Value = frmQuoteForm.txtMilla.Value * Factor
frmQuoteForm.txtMillb.Value = frmQuoteForm.txtMillb.Value * Factor
frmQuoteForm.txtMillc.Value = frmQuoteForm.txtMillc.Value * Factor
frmQuoteForm.txtMilld.Value = frmQuoteForm.txtMilld.Value * Factor
frmQuoteForm.txtMille.Value = frmQuoteForm.txtMille.Value * Factor
End Sub
Private Sub MachineHours_Click()
Factor = 2.5
LabourHours.Font.Bold = False
MachineHours.Font.Bold = True
frmQuoteForm.txtMilla.Value = frmQuoteForm.txtMilla.Value * (1 /
Factor)
frmQuoteForm.txtMillb.Value = frmQuoteForm.txtMillb.Value * (1 /
Factor)
frmQuoteForm.txtMillc.Value = frmQuoteForm.txtMillc.Value * (1 /
Factor)
frmQuoteForm.txtMilld.Value = frmQuoteForm.txtMilld.Value * (1 /
Factor)
frmQuoteForm.txtMille.Value = frmQuoteForm.txtMille.Value * (1 /
Factor)
End Sub
Regards
burl_h
Hours and Labour Hours. When the form is initially loaded it is with
Machine hours in the txtMilla thru txtMille text boxes . The operator
can then change from Machine Hours to Labour Hours by clicking the
Labour Hours command button, likewise the operator can change the
Labour Hours back to Machine Hours by clicking the Machine Hours
command button.
I need to overcome the problem of subsequence clicks on the same
command button, for example, if the labour hours were clicked twice one
could never get back to the original value of machine hours when the
machine hours button is clicked.
How would you code these such that after the labour hours command
button is clicked it is somewhat disabled until the machine hours has
been clicked. Or better yet can this be run from the same command
button, as on initial loading of the form it displays Machine Hours in
the text boxes, the command button caption could say Machine hours, but
when pressed it would convert the values in the text boxes to Labour
hours and display Labour Hours in the caption, then obvoiusly on
subsequent clicks it would toggle between the two, but the values
maintain integrity, any thoughts.
Private Sub LabourHours_Click()
Factor = 2.5
MachineHours.Font.Bold = False
LabourHours.Font.Bold = True
frmQuoteForm.txtMilla.Value = frmQuoteForm.txtMilla.Value * Factor
frmQuoteForm.txtMillb.Value = frmQuoteForm.txtMillb.Value * Factor
frmQuoteForm.txtMillc.Value = frmQuoteForm.txtMillc.Value * Factor
frmQuoteForm.txtMilld.Value = frmQuoteForm.txtMilld.Value * Factor
frmQuoteForm.txtMille.Value = frmQuoteForm.txtMille.Value * Factor
End Sub
Private Sub MachineHours_Click()
Factor = 2.5
LabourHours.Font.Bold = False
MachineHours.Font.Bold = True
frmQuoteForm.txtMilla.Value = frmQuoteForm.txtMilla.Value * (1 /
Factor)
frmQuoteForm.txtMillb.Value = frmQuoteForm.txtMillb.Value * (1 /
Factor)
frmQuoteForm.txtMillc.Value = frmQuoteForm.txtMillc.Value * (1 /
Factor)
frmQuoteForm.txtMilld.Value = frmQuoteForm.txtMilld.Value * (1 /
Factor)
frmQuoteForm.txtMille.Value = frmQuoteForm.txtMille.Value * (1 /
Factor)
End Sub
Regards
burl_h