Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Private Sub cmb10_Click()
- If MultiPage1.Value < MultiPage1.Pages.Count - 1 Then
- MultiPage1.Value = MultiPage1.Value + 1
- End If
- End Sub
- Private Sub cmb11_Click()
- If MultiPage1.Value > 0 Then
- MultiPage1.Value = MultiPage1.Value - 1
- End If
- End Sub
- Private Sub cmb12_Click()
- Me.Hide
- End Sub
- Private Sub cmb4_Click()
- If MultiPage1.Value < MultiPage1.Pages.Count - 1 Then
- MultiPage1.Value = MultiPage1.Value + 1
- End If
- End Sub
- Private Sub cmb5_Click()
- If MultiPage1.Value > 0 Then
- MultiPage1.Value = MultiPage1.Value - 1
- End If
- End Sub
- Private Sub cmb6_Click()
- Me.Hide
- End Sub
- Private Sub cmb7_Click()
- If MultiPage1.Value < MultiPage1.Pages.Count - 1 Then
- MultiPage1.Value = MultiPage1.Value + 1
- End If
- End Sub
- Private Sub cmb8_Click()
- If MultiPage1.Value > 0 Then
- MultiPage1.Value = MultiPage1.Value - 1
- End If
- End Sub
- Private Sub cmb9_Click()
- Me.Hide
- End Sub
- Private Sub cmbPlan_Change()
- With cmbPlan
- .AddItem "Essential"
- .AddItem "Ward"
- .AddItem "Semi-Private"
- .AddItem "Private"
- End With
- Dim Ans As String
- Ans = cmbPlan.Value
- End Sub
- Private Sub CommandButton1_Click()
- Me.Hide
- End Sub
- Private Sub Add_SatusItems()
- With ListBox_SmokingStatus
- .AddItem "Non-Smoker"
- .AddItem "Occasional"
- .AddItem "Regular"
- End With
- With ListBox_DrinkingStatus
- .AddItem "Non-Drinker"
- .AddItem "Occasional"
- .AddItem "Regular"
- End With
- With ListBox_LifestyleStatus
- .AddItem "Non-Active"
- .AddItem "Occasional"
- .AddItem "Regular"
- End With
- End Sub
- Private Sub ListBox_DrinkingStatus_Click()
- Dim selectedChoice As String ' Variable to store the user's choice
- With ListBox_DrinkingStatus
- .AddItem "Non-Drinker"
- .AddItem "Occasional"
- .AddItem "Regular"
- End With
- If ListBox_DrinkingStatus.ListIndex <> -1 Then ' Check if an item is selected
- selectedChoice = ListBox_DrinkingStatus.Value ' Store the selected choice
- Else
- MsgBox "Please select a drinking status." ' Display an error message if no item is selected
- End If
- ' Now you can use the selectedChoice variable for further processing or storing the value.
- ' Example: You can assign it to a different variable or use it in your code as needed.
- ' For example, if you have another variable called drinkChoice, you can assign the selectedChoice value to it:
- ' drinkChoice = selectedChoice
- End Sub
- Private Sub ListBox_LifestyleStatus_Click()
- Dim selectedChoice As String ' Variable to store the user's choice
- With ListBox_LifestyleStatus
- .AddItem "Non-Active"
- .AddItem "Occasional"
- .AddItem "Regular"
- End With
- If ListBox_LifestyleStatus.ListIndex <> -1 Then ' Check if an item is selected
- selectedChoice = ListBox_LifestyleStatus.List(ListBox_LifestyleStatus.ListIndex) ' Store the selected choice
- Else
- MsgBox "Please select a lifestyle status." ' Display an error message if no item is selected
- End If
- ' Now you can use the selectedChoice variable for further processing or storing the value.
- ' Example: You can assign it to a different variable or use it in your code as needed.
- ' For example, if you have another variable called lifestyleChoice, you can assign the selectedChoice value to it:
- ' lifestyleChoice = selectedChoice
- End Sub
- Private Sub ListBox_SmokingStatus_Click()
- Dim selectedChoice As String ' Variable to store the user's choice
- With ListBox_SmokingStatus
- .AddItem "Non-Smoker"
- .AddItem "Occasional"
- .AddItem "Regular"
- End With
- If ListBox_SmokingStatus.ListIndex <> -1 Then ' Check if an item is selected
- selectedChoice = ListBox_SmokingStatus.List(ListBox_SmokingStatus.ListIndex) ' Store the selected choice
- Else
- MsgBox "Please select a smoking status." ' Display an error message if no item is selected
- End If
- ' Now you can use the selectedChoice variable for further processing or storing the value.
- ' Example: You can assign it to a different variable or use it in your code as needed.
- ' For example, if you have another variable called userChoice, you can assign the selectedChoice value to it:
- ' userChoice = selectedChoice
- End Sub
- Private Sub MultiPage1_Change()
- End Sub
- Private Sub optbAllergiesNo_Click()
- Dim Allergy As String
- Allergy = Me.optbAllergiesNo.Value
- End Sub
- Private Sub optbAllergiesYes_Click()
- Dim Allergy As String
- Allegy = Me.optbAllergiesYes.Value
- End Sub
- Private Sub optbAnyNo_Click()
- Dim med As String
- med = optbAnyNo.Value
- End Sub
- Private Sub optbAnyYes_Click()
- Dim med As String
- med = optbAnyYes.Value
- End Sub
- Private Sub optbDecleration_Click()
- If Not optbDecleration.Value Then
- MsgBox "Please check the declaration box to proceed.", vbExclamation
- optbDecleration.Value = False ' Uncheck the option button
- End If
- End Sub
- Private Sub optbConsent_Click()
- ' Assuming you have a CheckBox named "optbConsent"
- If Not optbConsent.Value Then
- MsgBox "Please check the consent box to proceed.", vbExclamation
- optbConsent.Value = False ' Uncheck the option button
- End If
- End Sub
- Private Sub optbFemale_Click()
- Dim Gender As String
- Gender = Me.optbFemale.Value
- Gender = "Female"
- End Sub
- Private Sub optbHealthConAsthma_Click()
- Dim Asthama As String
- Asthama = optbHealthConAsthama.Value
- End Sub
- Private Sub optbHealthConCancer_Click()
- Dim None As String
- None = optbHealthConCancer.Value
- End Sub
- Private Sub optbHealthConDiabates_Click()
- Dim Diabetes As String
- Diabetes = optbHealthConDiabates.Value
- End Sub
- Private Sub optbHealthConHyper_Click()
- Dim Hyper As String
- Hyper = optbHealthConHyper.Value
- End Sub
- Private Sub optbMale_Click()
- Dim Gender As String
- Gender = Me.optbMale.Value
- Gender = "Male"
- End Sub
- Private Sub optbMedConYes_Click()
- Dim MedCon As String
- MedCon = "Yes"
- End Sub
- Private Sub optbMedConNo_Click()
- Dim MedCon As String
- MedCon = "No"
- End Sub
- Private Sub cmbPremium_Change()
- Dim selectedChoice As String ' Variable to store the user's choice
- With cmbPremium
- .AddItem "Base premium"
- End With
- If cmbPremium.ListIndex <> -1 Then ' Check if an item is selected
- selectedChoice = cmbPremium.Value ' Store the selected choice
- Else
- MsgBox "Please select a premium option." ' Display an error message if no item is selected
- End If
- ' Now you can use the selectedChoice variable for further processing or storing the value.
- ' Example: You can assign it to a different variable or use it in your code as needed.
- ' For example, if you have another variable called premiumChoice, you can assign the selectedChoice value to it:
- ' premiumChoice = selectedChoice
- End Sub
- Private Sub spinbYear_Change()
- Dim currentNumber As Double
- currentNumber = CDbl(txtYear.Value)
- currentNumber = currentNumber + 0.5
- txtYear.Value = currentNumber
- End Sub
- Private Sub btnDecrease_Click()
- Dim currentValue As Double
- currentValue = CDbl(txtYear.Value)
- currentValue = currentValue - 0.5
- txtYear.Value = currentValue
- End Sub
- Private Sub txtAddress_Change()
- Dim Addres As String
- Addres = Me.txtAddress.Value
- End Sub
- Private Sub txtContactNo_Change()
- Dim num As String
- num = Me.txtContactNo.Value
- End Sub
- Private Sub txtDOB_Change()
- Dim DOB As Date
- Dim validDate As Boolean
- validDate = IsDate(txtDOB.Value)
- If validDate Then
- DOB = CDate(txtDOB.Value)
- ' Date is valid, you can use the DOB variable for further processing or storing the value.
- ' Example: You can assign it to a different variable or use it in your code as needed.
- ' For example, if you have another variable called dateOfBirth, you can assign the DOB value to it:
- ' dateOfBirth = DOB
- Else
- MsgBox "Invalid date. Please enter a valid date."
- txtDOB.Value = ""
- txtDOB.SetFocus
- End If
- End Sub
- Private Sub txtEmergencyNo_Change()
- Dim emnum As String
- emnum = Me.txtEmergencyNo.Value
- End Sub
- Private Sub txtFirstname_Change()
- Dim Name As String
- Name = Me.txtFirstname.Value
- End Sub
- Private Sub txtHKID_Change()
- Dim ID As String
- ID = Me.txtHKID.Value
- End Sub
- Private Sub txtOccupation_Change()
- Dim work As String
- work = Me.txtOccupation.Value
- End Sub
- Private Sub txtPayFreq_Change()
- Dim currentValue As Integer
- currentValue = CInt(txtPayFreq.Value) ' Assuming you have a TextBox named "txtPayFreq"
- ' Store the currentValue in a variable or perform any other desired actions
- ' For example, you can store it in a global variable or process it further
- End Sub
- Private Sub spinbPay_Change()
- Dim currentValue As Integer
- currentValue = CInt(txtPayFreq.Value) ' Assuming you have a TextBox named "txtPayFreq"
- ' Determine which spin button was clicked
- If spinbPay.Value > currentValue Then
- ' Increase button was clicked
- currentValue = currentValue + 1
- ElseIf spinbPay.Value < currentValue Then
- ' Decrease button was clicked
- currentValue = currentValue - 1
- End If
- ' Update the TextBox with the new value
- txtPayFreq.Value = currentValue
- End Sub
- Private Sub txtPlanDate_Change()
- Dim enteredDate As Date
- Dim isValidDate As Boolean
- On Error Resume Next
- enteredDate = CDate(txtPlanDate.Value)
- If Err.Number <> 0 Then
- MsgBox "Error: " & Err.Description, vbExclamation
- Err.Clear
- Exit Sub
- End If
- On Error GoTo 0
- ' Check if the entered date is valid
- isValidDate = True ' If the code reaches this point, the date is valid
- ' Perform desired actions or store the date
- MsgBox "Entered date: " & enteredDate
- End Sub
- Private Sub txtYear_Change()
- Dim inputValue As Double
- Dim storedValue As Double
- inputValue = CDbl(txtYear.Value)
- storedValue = inputValue
- End Sub
- Private Sub UserForm_Activate()
- Call Add_SatusItems
- Call ListBox_SmokingStatus_Click
- Call ListBox_DrinkingStatus_Click
- Call ListBox_LifestyleStatus_Click
- Call cmbPlan_Change
- Call cmbPremium_Change
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement