S
sgl
Hi All,
I have the following code which executes well until the last line of code
TextBox9.Text. When it gets there it gives me a "mismatch error" althogh the
values stored for the calculation in TextBox10 and TextBox11 are correct.
Private Sub CommandButton3_Click()
' Calculate Total Days on Hire
' Make sure user has entered both dates
If Me.TextBox2.Text <> "" And Me.TextBox5 <> "" Then
Me.TextBox3.Text = Format(CDate(Me.TextBox5.Text) -
CDate(Me.TextBox2.Text), "#,##0.0000")
End If
' Before calculations commence check that all related TextBoxes are
complete
' Check for Total Days calculation and Daily Hire and Commissions Rate
If TextBox2.Text = "" Or TextBox5.Text = "" Or TextBox12.Text = "" Or
TextBox11.Text = "" Then
MsgBox "In order to proceed you need to complete all boxes relating
to" & vbCrLf & _
" Date From, Date To, Daily Hire Rate and Commissions Rate."
Else
' Calculate Total Hire
TextBox10.Text = Format(Val(CDbl(Me.TextBox12.Text)) *
Val(CDbl(Me.TextBox3.Text)), "#,##0.00")
' Calculate Total Commissions
TextBox9.Text = Format(Val(CDbl(Me.TextBox10.Text)) *
Val(CDbl(Me.TextBox11.Text)), "#,##0.00")
End If
End Sub
TextBox10 formated as - .Value = Format(.Text, "#,##0.00")
TextBox11 formated as - .Value = FormatPercent((CDbl(TextBox11) / 100), 2)
I have been looking at this for too long and my mind has completely
blocked.......
Many thanks for any assistance/sgl
I have the following code which executes well until the last line of code
TextBox9.Text. When it gets there it gives me a "mismatch error" althogh the
values stored for the calculation in TextBox10 and TextBox11 are correct.
Private Sub CommandButton3_Click()
' Calculate Total Days on Hire
' Make sure user has entered both dates
If Me.TextBox2.Text <> "" And Me.TextBox5 <> "" Then
Me.TextBox3.Text = Format(CDate(Me.TextBox5.Text) -
CDate(Me.TextBox2.Text), "#,##0.0000")
End If
' Before calculations commence check that all related TextBoxes are
complete
' Check for Total Days calculation and Daily Hire and Commissions Rate
If TextBox2.Text = "" Or TextBox5.Text = "" Or TextBox12.Text = "" Or
TextBox11.Text = "" Then
MsgBox "In order to proceed you need to complete all boxes relating
to" & vbCrLf & _
" Date From, Date To, Daily Hire Rate and Commissions Rate."
Else
' Calculate Total Hire
TextBox10.Text = Format(Val(CDbl(Me.TextBox12.Text)) *
Val(CDbl(Me.TextBox3.Text)), "#,##0.00")
' Calculate Total Commissions
TextBox9.Text = Format(Val(CDbl(Me.TextBox10.Text)) *
Val(CDbl(Me.TextBox11.Text)), "#,##0.00")
End If
End Sub
TextBox10 formated as - .Value = Format(.Text, "#,##0.00")
TextBox11 formated as - .Value = FormatPercent((CDbl(TextBox11) / 100), 2)
I have been looking at this for too long and my mind has completely
blocked.......
Many thanks for any assistance/sgl