Sam Summers
Registered User.
- Local time
- Today, 00:07
- Joined
- Sep 17, 2001
- Messages
- 939
Hi Guys,
This code works as long as i set breakpoints and step through it but if i just open the form and try it does not initialise variable 'a'
I must be missing something because it works perfectly otherwise?
Many thanks in advance.
This code works as long as i set breakpoints and step through it but if i just open the form and try it does not initialise variable 'a'
I must be missing something because it works perfectly otherwise?
Many thanks in advance.
Code:
Private Sub Form_Load()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim f As Integer
Dim g As Integer
Dim answer As Integer
Dim answer2 As Integer
Dim answer3 As Integer
Dim answer4 As Integer
Dim answer5 As Integer
Dim MyVar, MyVar2, MyCheck
MyVar = Me.TotalHours.Value
MyVar2 = Me.ServiceInterval.Value
If MyCheck = IsNull(MyVar) Or MyVar = "" Then
Else
End If
a = Me.TotalHours.Value
b = Me.ServiceInterval.Value
d = Me.Component_FlagInterval.Value
f = Me.WarningAt.Value
If IsNull(MyVar2) Or MyVar2 = "" Then
Exit Sub
Else
If Me.TotalHours.Value < MyVar2 Then
answer2 = b - Me.TotalHours.Value
' answer2 = b - a
Me.DueIn.Value = answer2
Else
answer = a / b
Me.Divider.Value = answer
e = Me.ServiceHour.Value
f = Me.WarningAt.Value
g = Me.WarningHour.Value
If a > e Then
answer3 = b + e
answer4 = answer3 - a
Me.DueIn.Value = answer4
Else
End If
End If
End If
End Sub