George Hallam
11-04-2008, 10:13 AM
Ok VB seems to be getting harder and harder
i designed the form that looks like the one below (label10 was put there by accident)
http://i289.photobucket.com/albums/ll221/jiggyghallam/enter.jpg
when the from is filled out the user clicks enter then all of the data entered goes into the boxes below. This can be done as many times as is needed and therefor changing the percentages each time
to be honest on this one i am toootally clueless i know it involves a lot of if statements and variables but i don't know what to do i have been staring at it for hours now putting in code here is what i have done so far and its not even 5% complete help :confused: :rolleyes:
Option Explicit
Private Sub cmdsubmit_Click()
Dim has_had_a_holiday_past_12_months As Boolean
Dim holiday_in_UK As Boolean
Dim holiday_abroad As Boolean
Dim less_than_2_weeks As Boolean
Dim more_than_2_weeks As Boolean
Static taken_test As Integer
Static been_on_holiday_for_percentage As Single
Static not_been_on_holiday_for_percentage As Single
Dim stayed_in_uk_for_percentage As Single
Dim went_abroad_for_percentage As Single
Dim went_less_than_2_weeks_for_percentage As Single
Dim went_more_than_2_weeks_for_percentage As Single
taken_test = 0
went_more_than_2_weeks_for_percentage = 0
went_less_than_2_weeks_for_percentage = 0
stayed_in_uk_for_percentage = 0
went_abroad_for_percentage = 0
been_on_holiday_for_percentage = 0
not_been_on_holiday_for_percentage = 0
holiday_in_UK = optuk.Value
holiday_abroad = optabroad.Value
has_had_a_holiday_past_12_months = optyes12months.Value
less_than_2_weeks = optlessthan2weeks.Value
more_than_2_weeks = optmorethan2weekse.Value
If holiday_past_12_yes = True Then
taken_test = taken_test + 1
been_on_holiday_for_percentage = been_on_holiday_for_percentage + 1
Else
taken_test = taken_test + 1
not_been_on_holiday_for_percentage = not_been_on_holiday_for_percentage + 1
End If
End Sub
Private Sub Form_Load()
Form1.Show
Form1.SetFocus
End Sub
Private Sub optno12months_Click()
optuk.Enabled = False
optabroad.Enabled = False
opt2.Enabled = False
opt2more.Enabled = False
End Sub
Private Sub optyes12months_Click()
optuk.Enabled = True
optabroad.Enabled = True
opt2.Enabled = True
opt2more.Enabled = True
End Sub
i designed the form that looks like the one below (label10 was put there by accident)
http://i289.photobucket.com/albums/ll221/jiggyghallam/enter.jpg
when the from is filled out the user clicks enter then all of the data entered goes into the boxes below. This can be done as many times as is needed and therefor changing the percentages each time
to be honest on this one i am toootally clueless i know it involves a lot of if statements and variables but i don't know what to do i have been staring at it for hours now putting in code here is what i have done so far and its not even 5% complete help :confused: :rolleyes:
Option Explicit
Private Sub cmdsubmit_Click()
Dim has_had_a_holiday_past_12_months As Boolean
Dim holiday_in_UK As Boolean
Dim holiday_abroad As Boolean
Dim less_than_2_weeks As Boolean
Dim more_than_2_weeks As Boolean
Static taken_test As Integer
Static been_on_holiday_for_percentage As Single
Static not_been_on_holiday_for_percentage As Single
Dim stayed_in_uk_for_percentage As Single
Dim went_abroad_for_percentage As Single
Dim went_less_than_2_weeks_for_percentage As Single
Dim went_more_than_2_weeks_for_percentage As Single
taken_test = 0
went_more_than_2_weeks_for_percentage = 0
went_less_than_2_weeks_for_percentage = 0
stayed_in_uk_for_percentage = 0
went_abroad_for_percentage = 0
been_on_holiday_for_percentage = 0
not_been_on_holiday_for_percentage = 0
holiday_in_UK = optuk.Value
holiday_abroad = optabroad.Value
has_had_a_holiday_past_12_months = optyes12months.Value
less_than_2_weeks = optlessthan2weeks.Value
more_than_2_weeks = optmorethan2weekse.Value
If holiday_past_12_yes = True Then
taken_test = taken_test + 1
been_on_holiday_for_percentage = been_on_holiday_for_percentage + 1
Else
taken_test = taken_test + 1
not_been_on_holiday_for_percentage = not_been_on_holiday_for_percentage + 1
End If
End Sub
Private Sub Form_Load()
Form1.Show
Form1.SetFocus
End Sub
Private Sub optno12months_Click()
optuk.Enabled = False
optabroad.Enabled = False
opt2.Enabled = False
opt2more.Enabled = False
End Sub
Private Sub optyes12months_Click()
optuk.Enabled = True
optabroad.Enabled = True
opt2.Enabled = True
opt2more.Enabled = True
End Sub