Advertisement
mir456789

codex

Apr 19th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.56 KB | None | 0 0
  1. Option Explicit
  2.  
  3.  
  4. Private Sub cmb10_Click()
  5. If MultiPage1.Value < MultiPage1.Pages.Count - 1 Then
  6. MultiPage1.Value = MultiPage1.Value + 1
  7. End If
  8. End Sub
  9.  
  10. Private Sub cmb11_Click()
  11. If MultiPage1.Value > 0 Then
  12. MultiPage1.Value = MultiPage1.Value - 1
  13. End If
  14. End Sub
  15.  
  16. Private Sub cmb12_Click()
  17. Me.Hide
  18. End Sub
  19.  
  20.  
  21.  
  22. Private Sub cmb4_Click()
  23. If MultiPage1.Value < MultiPage1.Pages.Count - 1 Then
  24. MultiPage1.Value = MultiPage1.Value + 1
  25. End If
  26. End Sub
  27.  
  28. Private Sub cmb5_Click()
  29. If MultiPage1.Value > 0 Then
  30. MultiPage1.Value = MultiPage1.Value - 1
  31. End If
  32. End Sub
  33.  
  34. Private Sub cmb6_Click()
  35. Me.Hide
  36. End Sub
  37.  
  38. Private Sub cmb7_Click()
  39. If MultiPage1.Value < MultiPage1.Pages.Count - 1 Then
  40. MultiPage1.Value = MultiPage1.Value + 1
  41. End If
  42. End Sub
  43.  
  44. Private Sub cmb8_Click()
  45. If MultiPage1.Value > 0 Then
  46. MultiPage1.Value = MultiPage1.Value - 1
  47. End If
  48. End Sub
  49.  
  50. Private Sub cmb9_Click()
  51. Me.Hide
  52. End Sub
  53.  
  54. Private Sub cmbPlan_Change()
  55. With cmbPlan
  56. .AddItem "Essential"
  57. .AddItem "Ward"
  58. .AddItem "Semi-Private"
  59. .AddItem "Private"
  60. End With
  61.  
  62.  
  63. Dim Ans As String
  64. Ans = cmbPlan.Value
  65.  
  66.  
  67. End Sub
  68.  
  69.  
  70.  
  71. Private Sub CommandButton1_Click()
  72. Me.Hide
  73. End Sub
  74.  
  75. Private Sub Add_SatusItems()
  76. With ListBox_SmokingStatus
  77. .AddItem "Non-Smoker"
  78. .AddItem "Occasional"
  79. .AddItem "Regular"
  80. End With
  81.  
  82. With ListBox_DrinkingStatus
  83. .AddItem "Non-Drinker"
  84. .AddItem "Occasional"
  85. .AddItem "Regular"
  86. End With
  87.  
  88. With ListBox_LifestyleStatus
  89. .AddItem "Non-Active"
  90. .AddItem "Occasional"
  91. .AddItem "Regular"
  92. End With
  93. End Sub
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101. Private Sub ListBox_DrinkingStatus_Click()
  102. Dim selectedChoice As String ' Variable to store the user's choice
  103.  
  104. With ListBox_DrinkingStatus
  105. .AddItem "Non-Drinker"
  106. .AddItem "Occasional"
  107. .AddItem "Regular"
  108. End With
  109.  
  110. If ListBox_DrinkingStatus.ListIndex <> -1 Then ' Check if an item is selected
  111. selectedChoice = ListBox_DrinkingStatus.Value ' Store the selected choice
  112. Else
  113. MsgBox "Please select a drinking status." ' Display an error message if no item is selected
  114. End If
  115.  
  116. ' Now you can use the selectedChoice variable for further processing or storing the value.
  117. ' Example: You can assign it to a different variable or use it in your code as needed.
  118.  
  119. ' For example, if you have another variable called drinkChoice, you can assign the selectedChoice value to it:
  120. ' drinkChoice = selectedChoice
  121. End Sub
  122. Private Sub ListBox_LifestyleStatus_Click()
  123. Dim selectedChoice As String ' Variable to store the user's choice
  124.  
  125. With ListBox_LifestyleStatus
  126. .AddItem "Non-Active"
  127. .AddItem "Occasional"
  128. .AddItem "Regular"
  129. End With
  130.  
  131. If ListBox_LifestyleStatus.ListIndex <> -1 Then ' Check if an item is selected
  132. selectedChoice = ListBox_LifestyleStatus.List(ListBox_LifestyleStatus.ListIndex) ' Store the selected choice
  133. Else
  134. MsgBox "Please select a lifestyle status." ' Display an error message if no item is selected
  135. End If
  136.  
  137. ' Now you can use the selectedChoice variable for further processing or storing the value.
  138. ' Example: You can assign it to a different variable or use it in your code as needed.
  139.  
  140. ' For example, if you have another variable called lifestyleChoice, you can assign the selectedChoice value to it:
  141. ' lifestyleChoice = selectedChoice
  142. End Sub
  143.  
  144. Private Sub ListBox_SmokingStatus_Click()
  145. Dim selectedChoice As String ' Variable to store the user's choice
  146.  
  147. With ListBox_SmokingStatus
  148. .AddItem "Non-Smoker"
  149. .AddItem "Occasional"
  150. .AddItem "Regular"
  151. End With
  152.  
  153. If ListBox_SmokingStatus.ListIndex <> -1 Then ' Check if an item is selected
  154. selectedChoice = ListBox_SmokingStatus.List(ListBox_SmokingStatus.ListIndex) ' Store the selected choice
  155. Else
  156. MsgBox "Please select a smoking status." ' Display an error message if no item is selected
  157. End If
  158.  
  159. ' Now you can use the selectedChoice variable for further processing or storing the value.
  160. ' Example: You can assign it to a different variable or use it in your code as needed.
  161.  
  162. ' For example, if you have another variable called userChoice, you can assign the selectedChoice value to it:
  163. ' userChoice = selectedChoice
  164. End Sub
  165.  
  166. Private Sub MultiPage1_Change()
  167.  
  168. End Sub
  169.  
  170. Private Sub optbAllergiesNo_Click()
  171. Dim Allergy As String
  172. Allergy = Me.optbAllergiesNo.Value
  173. End Sub
  174.  
  175. Private Sub optbAllergiesYes_Click()
  176. Dim Allergy As String
  177. Allegy = Me.optbAllergiesYes.Value
  178.  
  179. End Sub
  180.  
  181. Private Sub optbAnyNo_Click()
  182. Dim med As String
  183. med = optbAnyNo.Value
  184.  
  185. End Sub
  186.  
  187. Private Sub optbAnyYes_Click()
  188. Dim med As String
  189. med = optbAnyYes.Value
  190.  
  191. End Sub
  192.  
  193. Private Sub optbDecleration_Click()
  194. If Not optbDecleration.Value Then
  195. MsgBox "Please check the declaration box to proceed.", vbExclamation
  196. optbDecleration.Value = False ' Uncheck the option button
  197. End If
  198.  
  199.  
  200. End Sub
  201.  
  202.  
  203. Private Sub optbConsent_Click()
  204.  
  205. ' Assuming you have a CheckBox named "optbConsent"
  206. If Not optbConsent.Value Then
  207. MsgBox "Please check the consent box to proceed.", vbExclamation
  208. optbConsent.Value = False ' Uncheck the option button
  209. End If
  210.  
  211.  
  212. End Sub
  213.  
  214.  
  215.  
  216. Private Sub optbFemale_Click()
  217. Dim Gender As String
  218. Gender = Me.optbFemale.Value
  219. Gender = "Female"
  220.  
  221. End Sub
  222.  
  223. Private Sub optbHealthConAsthma_Click()
  224. Dim Asthama As String
  225. Asthama = optbHealthConAsthama.Value
  226. End Sub
  227.  
  228. Private Sub optbHealthConCancer_Click()
  229. Dim None As String
  230. None = optbHealthConCancer.Value
  231.  
  232.  
  233. End Sub
  234.  
  235. Private Sub optbHealthConDiabates_Click()
  236. Dim Diabetes As String
  237. Diabetes = optbHealthConDiabates.Value
  238.  
  239.  
  240. End Sub
  241.  
  242. Private Sub optbHealthConHyper_Click()
  243. Dim Hyper As String
  244. Hyper = optbHealthConHyper.Value
  245.  
  246. End Sub
  247.  
  248. Private Sub optbMale_Click()
  249. Dim Gender As String
  250. Gender = Me.optbMale.Value
  251. Gender = "Male"
  252.  
  253.  
  254. End Sub
  255.  
  256. Private Sub optbMedConYes_Click()
  257. Dim MedCon As String
  258. MedCon = "Yes"
  259. End Sub
  260.  
  261. Private Sub optbMedConNo_Click()
  262. Dim MedCon As String
  263. MedCon = "No"
  264. End Sub
  265.  
  266. Private Sub cmbPremium_Change()
  267. Dim selectedChoice As String ' Variable to store the user's choice
  268.  
  269. With cmbPremium
  270. .AddItem "Base premium"
  271. End With
  272.  
  273. If cmbPremium.ListIndex <> -1 Then ' Check if an item is selected
  274. selectedChoice = cmbPremium.Value ' Store the selected choice
  275. Else
  276. MsgBox "Please select a premium option." ' Display an error message if no item is selected
  277. End If
  278.  
  279. ' Now you can use the selectedChoice variable for further processing or storing the value.
  280. ' Example: You can assign it to a different variable or use it in your code as needed.
  281.  
  282. ' For example, if you have another variable called premiumChoice, you can assign the selectedChoice value to it:
  283. ' premiumChoice = selectedChoice
  284. End Sub
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294. Private Sub spinbYear_Change()
  295. Dim currentNumber As Double
  296. currentNumber = CDbl(txtYear.Value)
  297.  
  298. currentNumber = currentNumber + 0.5
  299. txtYear.Value = currentNumber
  300.  
  301. End Sub
  302. Private Sub btnDecrease_Click()
  303. Dim currentValue As Double
  304. currentValue = CDbl(txtYear.Value)
  305. currentValue = currentValue - 0.5
  306. txtYear.Value = currentValue
  307. End Sub
  308.  
  309. Private Sub txtAddress_Change()
  310. Dim Addres As String
  311. Addres = Me.txtAddress.Value
  312. End Sub
  313.  
  314. Private Sub txtContactNo_Change()
  315. Dim num As String
  316. num = Me.txtContactNo.Value
  317.  
  318. End Sub
  319.  
  320. Private Sub txtDOB_Change()
  321. Dim DOB As Date
  322. Dim validDate As Boolean
  323.  
  324. validDate = IsDate(txtDOB.Value)
  325.  
  326. If validDate Then
  327. DOB = CDate(txtDOB.Value)
  328. ' Date is valid, you can use the DOB variable for further processing or storing the value.
  329. ' Example: You can assign it to a different variable or use it in your code as needed.
  330. ' For example, if you have another variable called dateOfBirth, you can assign the DOB value to it:
  331. ' dateOfBirth = DOB
  332. Else
  333. MsgBox "Invalid date. Please enter a valid date."
  334. txtDOB.Value = ""
  335. txtDOB.SetFocus
  336. End If
  337. End Sub
  338.  
  339.  
  340. Private Sub txtEmergencyNo_Change()
  341. Dim emnum As String
  342. emnum = Me.txtEmergencyNo.Value
  343. End Sub
  344.  
  345. Private Sub txtFirstname_Change()
  346. Dim Name As String
  347. Name = Me.txtFirstname.Value
  348.  
  349. End Sub
  350.  
  351. Private Sub txtHKID_Change()
  352. Dim ID As String
  353. ID = Me.txtHKID.Value
  354.  
  355. End Sub
  356.  
  357. Private Sub txtOccupation_Change()
  358. Dim work As String
  359. work = Me.txtOccupation.Value
  360.  
  361. End Sub
  362.  
  363. Private Sub txtPayFreq_Change()
  364. Dim currentValue As Integer
  365. currentValue = CInt(txtPayFreq.Value) ' Assuming you have a TextBox named "txtPayFreq"
  366.  
  367. ' Store the currentValue in a variable or perform any other desired actions
  368. ' For example, you can store it in a global variable or process it further
  369.  
  370. End Sub
  371.  
  372. Private Sub spinbPay_Change()
  373. Dim currentValue As Integer
  374. currentValue = CInt(txtPayFreq.Value) ' Assuming you have a TextBox named "txtPayFreq"
  375.  
  376. ' Determine which spin button was clicked
  377. If spinbPay.Value > currentValue Then
  378. ' Increase button was clicked
  379. currentValue = currentValue + 1
  380. ElseIf spinbPay.Value < currentValue Then
  381. ' Decrease button was clicked
  382. currentValue = currentValue - 1
  383. End If
  384.  
  385. ' Update the TextBox with the new value
  386. txtPayFreq.Value = currentValue
  387. End Sub
  388.  
  389. Private Sub txtPlanDate_Change()
  390. Dim enteredDate As Date
  391. Dim isValidDate As Boolean
  392.  
  393. On Error Resume Next
  394. enteredDate = CDate(txtPlanDate.Value)
  395. If Err.Number <> 0 Then
  396. MsgBox "Error: " & Err.Description, vbExclamation
  397. Err.Clear
  398. Exit Sub
  399. End If
  400. On Error GoTo 0
  401.  
  402. ' Check if the entered date is valid
  403. isValidDate = True ' If the code reaches this point, the date is valid
  404.  
  405. ' Perform desired actions or store the date
  406. MsgBox "Entered date: " & enteredDate
  407. End Sub
  408.  
  409. Private Sub txtYear_Change()
  410. Dim inputValue As Double
  411. Dim storedValue As Double
  412. inputValue = CDbl(txtYear.Value)
  413. storedValue = inputValue
  414. End Sub
  415.  
  416. Private Sub UserForm_Activate()
  417.  
  418. Call Add_SatusItems
  419. Call ListBox_SmokingStatus_Click
  420. Call ListBox_DrinkingStatus_Click
  421. Call ListBox_LifestyleStatus_Click
  422. Call cmbPlan_Change
  423. Call cmbPremium_Change
  424.  
  425.  
  426.  
  427. End Sub
  428.  
  429.  
  430.  
  431.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement