Hi all
Error checking is not typically something I've thought much about in the past but in this one instance I'm looking to employ it and I'm a little stuck.
I'm working on a template at the moment for purchase ledger which requires that the user put in the total of the invoice first (ComboBox100) and then go into more detail on the breakdown of the invoice on the same userform page.
I'm employing a multipage userform with a commandbutton which takes the user on to the next page. I figured the easiest way to do the error checking would be to compare the value of the Total with the total of each of the fields in the breakdown.
The breakdown is structured with 8 rows of ComboBoxes with options for "Principal", "Interest", "Costs" and "Credit" which the user can select from as they require and a field beside it (another ComboBox) to hold the value.
Principal
Interest
Costs
Credit1000.00
I had defined PrincipalOne to PrincipalEight, InterestOne to InterestEight, CostsOne to CostsEight, CreditOne to CreditEight and TotalOne to TotalEight as Single.
Then in the CommandButton I'd tried:-
Unfortunately I can't seem to make it work and I don't know why.Code:Private Sub CommandButton1.Click()
If Me.ComboBox1.Value = "Principal" Then
iPrincipalOne = Me.ComboBox2.Value
Else
End If
If Me.ComboBox1.Value = "Interest" Then
iInterestOne = Me.ComboBox2.Value
Else
End If
If Me.ComboBox1,Value = "Costs" Then
iCostsOne = Me.ComboBox2.Value"
Else
End If
If Me.ComboBox1,Value = "Credit" Then
iCreditOne = Me.ComboBox2.Value"
Else
End If
If Me.ComboBox1.Value = vbNullString Then
iPrincipalOne = vbNullString
iInterestOne = vbNullString
iCostsOne = vbNullString
iCreditOne = vbNullString
End If
End Sub
iTotal = iPrincipalOne + iInterestOne + iCostsOne -iCreditOne
If Me.ComboBox100.Value <> iTotal Then
Msgbox ("Something is fishy here..."
Else
Multipage1.Value = 2
End If
Any ideas?
Thanks very much in advance as always
Dav