Private Sub btnBack1_Click()
Dim i As Long
i = MultiPage1.Pages.Count - 1
'If you are on the first Page select the last one
If MultiPage1.Value = 0 Then
MultiPage1.Value = i
'If you are on the any other page - select the previous one
Else
MultiPage1.Value = MultiPage1.Value - 1
End If
End Sub
Private Sub btnBack2_Click()
Dim i As Long
i = MultiPage1.Pages.Count - 1
'If you are on the first Page select the last one
If MultiPage1.Value = 0 Then
MultiPage1.Value = i
'If you are on the any other page - select the previous one
Else
MultiPage1.Value = MultiPage1.Value - 1
End If
End Sub
Private Sub btnBack3_Click()
Dim i As Long
i = MultiPage1.Pages.Count - 1
'If you are on the first Page select the last one
If MultiPage1.Value = 0 Then
MultiPage1.Value = i
'If you are on the any other page - select the previous one
Else
MultiPage1.Value = MultiPage1.Value - 1
End If
End Sub
Private Sub btnClose_Click()
Dim c
For Each c In CommandBars
c.Enabled = True
Next
Unload Me
'ThisWorkbook.Close savechanges:=True
Application.Quit
End Sub
Private Sub btnNext1_Click()
Dim i As Long
i = MultiPage1.Pages.Count - 1
'If you are on the last Page select the first one
If MultiPage1.Value = i Then
MultiPage1.Value = 0
'If you are on the any other page - select the next one
Else
MultiPage1.Value = MultiPage1.Value + 1
End If
End Sub
Private Sub btnNext2_Click()
Dim i As Long
i = MultiPage1.Pages.Count - 1
'If you are on the last Page select the first one
If MultiPage1.Value = i Then
MultiPage1.Value = 0
'If you are on the any other page - select the next one
Else
MultiPage1.Value = MultiPage1.Value + 1
End If
End Sub
Private Sub btnNext3_Click()
Dim i As Long
i = MultiPage1.Pages.Count - 1
'If you are on the last Page select the first one
If MultiPage1.Value = i Then
MultiPage1.Value = 0
'If you are on the any other page - select the next one
Else
MultiPage1.Value = MultiPage1.Value + 1
End If
End Sub
Private Sub btnSave_Click()
ActiveWorkbook.Sheets("Data").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtID.Value
' Continue offset list below
ActiveCell.Offset(0, 1) = txtSurName.Value
ActiveCell.Offset(0, 2) = txtForeName.Value
ActiveCell.Offset(0, 3) = txtNHS.Value
ActiveCell.Offset(0, 4) = txtSF.Value
ActiveCell.Offset(0, 5) = txtDOB.Value
ActiveCell.Offset(0, 6) = txtPostcode.Value
ActiveCell.Offset(0, 7) = txtLHB.Value
ActiveCell.Offset(0, 8) = txtDateRef.Value
ActiveCell.Offset(0, 9) = cboTreatment.Value
ActiveCell.Offset(0, 10) = cboIfFET.Value
ActiveCell.Offset(0, 11) = txtBMI.Value
ActiveCell.Offset(0, 12) = cboNoEmb.Value
ActiveCell.Offset(0, 13) = txtNoEmb_Comm.Value
ActiveCell.Offset(0, 14) = txtEmbFroz.Value
ActiveCell.Offset(0, 15) = txtEmbryoDateStorage.Value
ActiveCell.Offset(0, 16) = cboInfertility1.Value
ActiveCell.Offset(0, 17) = txtInfertility1.Value
ActiveCell.Offset(0, 18) = cboInfertility2.Value
ActiveCell.Offset(0, 19) = txtInfertility2.Value
ActiveCell.Offset(0, 20) = txtInfertDuration.Value
ActiveCell.Offset(0, 21) = txtCycle.Value
ActiveCell.Offset(0, 22) = txtGonad.Value
ActiveCell.Offset(0, 23) = txtDoseStart.Value
ActiveCell.Offset(0, 24) = cboRegime.Value
ActiveCell.Offset(0, 25) = txtFollicles.Value
ActiveCell.Offset(0, 26) = txtDateEggCollect.Value
ActiveCell.Offset(0, 27) = txtDateCancel.Value
ActiveCell.Offset(0, 28) = cboCancellation.Value
ActiveCell.Offset(0, 29) = cboIfOHSS.Value
ActiveCell.Offset(0, 30) = cboEmbReplace.Value
ActiveCell.Offset(0, 31) = txtDateET.Value
ActiveCell.Offset(0, 32) = txtEmbReplace_Comm.Value
ActiveCell.Offset(0, 33) = cboPassageCath.Value
ActiveCell.Offset(0, 34) = txtIUI_Comm.Value
ActiveCell.Offset(0, 35) = cboSpermConcent.Value
ActiveCell.Offset(0, 36) = txtDonorNumber.Value
ActiveCell.Offset(0, 37) = cboFollicDrainPerform.Value
ActiveCell.Offset(0, 38) = txtFollicDrain_Number.Value
ActiveCell.Offset(0, 39) = cboOocytes.Value
ActiveCell.Offset(0, 40) = txtOocytesNumb.Value
ActiveCell.Offset(0, 41) = txtOocytesInject.Value
ActiveCell.Offset(0, 42) = txtOocytesDamage.Value
ActiveCell.Offset(0, 43) = txtOocytesNormFert.Value
ActiveCell.Offset(0, 44) = txtOocytesAbnormFert.Value
ActiveCell.Offset(0, 45) = txtOocytes_Comm.Value
ActiveCell.Offset(0, 46) = txtFailedFert_Comm.Value
ActiveCell.Offset(0, 47) = cboSourceSperm.Value
ActiveCell.Offset(0, 48) = txtVolume.Value
ActiveCell.Offset(0, 49) = cboEmbryo.Value
ActiveCell.Offset(0, 50) = txtSplit_Comm.Value
ActiveCell.Offset(0, 51) = txtEmbryoTrans.Value
ActiveCell.Offset(0, 52) = txtEmbryoGrade.Value
ActiveCell.Offset(0, 53) = txtCellNumber.Value
ActiveCell.Offset(0, 54) = txtEmbryo_Comm.Value
ActiveCell.Offset(0, 55) = txtEmbryoFroz.Value
ActiveCell.Offset(0, 56) = txtStorageDate.Value
ActiveCell.Offset(0, 57) = cboOutcome.Value
ActiveCell.Offset(0, 58) = cboOutcomeType.Value
ActiveCell.Offset(0, 59) = cboOutcomeFetalNumb.Value
ActiveCell.Offset(0, 60) = txtOutcome_Comm.Value
ActiveCell.Offset(0, 61) = cboFHSeen.Value
ActiveCell.Offset(0, 62) = txtDateUSS.Value
' Select the first Cell of the Data Sheet
Range("A1").Select
Call Userform_Initialize
Dim frm As frmMain
Dim vResponse As Variant
'Instantiate frmMain
'This has the same effect as: Load frmMain
Set frm = New frmMain
vResponse = MsgBox("Would you like to enter another pathway record?", vbYesNo)
If vResponse = vbYes Then
'Reload the form
' Call Test
frm.Show
End If
' If not...
Unload Me
dbsplash.Show
End Sub
Private Sub cboCancellation_Click()
cboIfOHSS.Enabled = cboCancellation = "OHSS"
lblOHSS.Enabled = cboCancellation = "OHSS"
End Sub
Private Sub cboEmbRepIfDifficult_Click()
txtEmbReplace_Comm.Enabled = cboEmbRepIfDifficult = "No Embryo Replacement"
End Sub
Private Sub cboEmbReplace_Click()
cboEmbRepIfDifficult.Enabled = cboEmbReplace = "Difficult"
lblIfDiff.Enabled = cboEmbReplace = "Difficult"
txtDateET.Enabled = cboEmbReplace = "Easy"
End Sub
Private Sub cboEmbryo_Click()
txtSplit_Comm.Enabled = cboEmbryo = "ICSI/IVF Split"
End Sub
Private Sub cboInfertility1_Change()
End Sub
Private Sub cboNoEmb_Click()
txtNoEmb_Comm.Enabled = cboNoEmb = "No Fertilisation"
End Sub
Private Sub cboOutcome_Click()
'you can substitute the previous 5 lines by this oneliner
cboOutcomeType.Enabled = cboOutcome = "Positive"
lbl_OutcomePositive.Enabled = cboOutcome = "Positive"
End Sub
Private Sub cboTreatment_Click()
cboIfFET.Enabled = cboTreatment = "FET"
lblIfFET.Enabled = cboTreatment = "FET"
End Sub
Private Sub txtDateCancel_AfterUpdate()
Dim Ln1 As String, _
Ln2 As String, _
Ln3 As String, _
Title As String
If Len(txtDateCancel.Text) <> 6 Then
Ln1 = "You must enter 6 numeric characters to represent the desired date." & Chr(10)
Ln2 = "(For example, to enter the date May 7, 2006 you simply enter 070506)" & Chr(10) & Chr(10)
Ln3 = "Please try again."
Title = "Invalid Date Entry"
MsgBox (Ln1 & Ln2 & Ln3), , Title
txtDateCancel.Text = ""
Else: txtDateCancel.Text = Format(txtDateCancel.Text, "##/##/##")
End If
End Sub
Private Sub txtDateEggCollect_AfterUpdate()
Dim Ln1 As String, _
Ln2 As String, _
Ln3 As String, _
Title As String
If Len(txtDateEggCollect.Text) <> 6 Then
Ln1 = "You must enter 6 numeric characters to represent the desired date." & Chr(10)
Ln2 = "(For example, to enter the date May 7, 2006 you simply enter 070506)" & Chr(10) & Chr(10)
Ln3 = "Please try again."
Title = "Invalid Date Entry"
MsgBox (Ln1 & Ln2 & Ln3), , Title
txtDateEggCollect.Text = ""
Else: txtDateEggCollect.Text = Format(txtDateEggCollect.Text, "##/##/##")
End If
End Sub
Private Sub txtDateET_Change()
Dim Ln1 As String, _
Ln2 As String, _
Ln3 As String, _
Title As String
If Len(txtDateET.Text) <> 6 Then
Ln1 = "You must enter 6 numeric characters to represent the desired date." & Chr(10)
Ln2 = "(For example, to enter the date May 7, 2006 you simply enter 070506)" & Chr(10) & Chr(10)
Ln3 = "Please try again."
Title = "Invalid Date Entry"
MsgBox (Ln1 & Ln2 & Ln3), , Title
txtDateET.Text = ""
Else: txtDateET.Text = Format(txtDateET.Text, "##/##/##")
End If
End Sub
Private Sub txtDateRef_AfterUpdate()
Dim Ln1 As String, _
Ln2 As String, _
Ln3 As String, _
Title As String
If Len(txtDateRef.Text) <> 6 Then
Ln1 = "You must enter 6 numeric characters to represent the desired date." & Chr(10)
Ln2 = "(For example, to enter the date May 7, 2006 you simply enter 070506)" & Chr(10) & Chr(10)
Ln3 = "Please try again."
Title = "Invalid Date Entry"
MsgBox (Ln1 & Ln2 & Ln3), , Title
txtDateRef.Text = ""
Else: txtDateRef.Text = Format(txtDateRef.Text, "##/##/##")
End If
End Sub
Private Sub txtDateUSS_AfterUpdate()
Dim Ln1 As String, _
Ln2 As String, _
Ln3 As String, _
Title As String
If Len(txtDateUSS.Text) <> 6 Then
Ln1 = "You must enter 6 numeric characters to represent the desired date." & Chr(10)
Ln2 = "(For example, to enter the date May 7, 2006 you simply enter 070506)" & Chr(10) & Chr(10)
Ln3 = "Please try again."
Title = "Invalid Date Entry"
MsgBox (Ln1 & Ln2 & Ln3), , Title
txtDateUSS.Text = ""
Else: txtDateUSS.Text = Format(txtDateUSS.Text, "##/##/##")
End If
End Sub
Private Sub txtDOB_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End Sub
'Private Sub txtDOB_AfterUpdate()
' Me.txtDOB = DateFormat1(txtDOB)
'End Sub
Private Sub txtDOB_AfterUpdate()
Dim Ln1 As String, _
Ln2 As String, _
Ln3 As String, _
Title As String
If Len(txtDOB.Text) <> 6 Then
Ln1 = "You must enter 6 numeric characters to represent the desired date." & Chr(10)
Ln2 = "(For example, to enter the date May 7, 2006 you simply enter 070506)" & Chr(10) & Chr(10)
Ln3 = "Please try again."
Title = "Invalid Date Entry"
MsgBox (Ln1 & Ln2 & Ln3), , Title
txtDOB.Text = ""
Else: txtDOB.Text = Format(txtDOB.Text, "##/##/##")
End If
End Sub
Private Sub txtEmbryoDateStorage_AfterUpdate()
Dim Ln1 As String, _
Ln2 As String, _
Ln3 As String, _
Title As String
If Len(txtEmbryoDateStorage.Text) <> 6 Then
Ln1 = "You must enter 6 numeric characters to represent the desired date." & Chr(10)
Ln2 = "(For example, to enter the date May 7, 2006 you simply enter 070506)" & Chr(10) & Chr(10)
Ln3 = "Please try again."
Title = "Invalid Date Entry"
MsgBox (Ln1 & Ln2 & Ln3), , Title
txtEmbryoDateStorage.Text = ""
Else: txtEmbryoDateStorage.Text = Format(txtEmbryoDateStorage.Text, "##/##/##")
End If
End Sub
Private Sub txtStorageDate_AfterUpdate()
Dim Ln1 As String, _
Ln2 As String, _
Ln3 As String, _
Title As String
If Len(txtStorageDate.Text) <> 6 Then
Ln1 = "You must enter 6 numeric characters to represent the desired date." & Chr(10)
Ln2 = "(For example, to enter the date May 7, 2006 you simply enter 070506)" & Chr(10) & Chr(10)
Ln3 = "Please try again."
Title = "Invalid Date Entry"
MsgBox (Ln1 & Ln2 & Ln3), , Title
txtStorageDate.Text = ""
Else: txtStorageDate.Text = Format(txtStorageDate.Text, "##/##/##")
End If
End Sub
Private Sub txtSurName_AfterUpdate()
Me.txtSurName = ConvertToProper(txtSurName)
End Sub
Private Sub txtForeName_AfterUpdate()
Me.txtForeName = ConvertToProper(txtForeName)
End Sub
Private Sub Userform_Initialize()
'Select the first Page
MultiPage1.Value = 0
cboOutcomeType.Enabled = False
lbl_OutcomePositive.Enabled = False
txtNoEmb_Comm.Enabled = False
cboIfFET.Enabled = False
lblIfFET.Enabled = False
cboEmbRepIfDifficult.Enabled = False
cboIfOHSS.Enabled = False
txtNoEmb_Comm.Enabled = False
lblIfDiff.Enabled = False
lblOHSS.Enabled = False
txtSplit_Comm.Enabled = False
txtEmbReplace_Comm.Enabled = False
txtDateET.Enabled = False
lblDateET.Enabled = False
'Source from Spreadsheet Columns
'Dim x As Worksheet, i As Integer
'Set x = Worksheets("DataOptions")
'i = 2
'With cboTreatment
'.Clear
'Do Until IsEmpty(x.Cells(i, 1))
'.AddItem (x.Cells(i, 1))
'i = i + 1
'Loop
'End With
txtID.SetFocus
With cboTreatment
.AddItem "ICSI"
.AddItem "IVF"
.AddItem "DIVF"
.AddItem "FET"
End With
cboTreatment.Value = ""
With cboIfFET
.AddItem "ICSI embryos"
.AddItem "IVF embryos"
.AddItem "ICSI/IVF embryos"
.AddItem "Oocyte Donation"
.AddItem "Oocyte Recipient"
.AddItem "IUI"
.AddItem "DIUI"
End With
cboIfFET.Value = ""
With cboNoEmb
.AddItem "Freeze All"
.AddItem "No Fertilisation"
End With
cboNoEmb.Value = ""
With cboInfertility1
.AddItem "Unexplained"
.AddItem "Tubal factor"
.AddItem "Male factor"
.AddItem "Ovulatory disorder"
.AddItem "Endometriosis"
.AddItem "Other"
End With
cboInfertility1.Value = ""
With cboInfertility2
.AddItem "Tubal factor"
.AddItem "Male factor"
.AddItem "Ovultory disorder"
.AddItem "Endometriosis"
.AddItem "Other"
End With
cboInfertility2.Value = ""
With cboRegime
.AddItem "Step up"
.AddItem "Step down"
.AddItem "Stable"
End With
cboRegime.Value = ""
With cboCancellation
.AddItem "Poor response"
.AddItem "High FSH"
.AddItem "OHSS"
End With
cboCancellation.Value = ""
With cboOutcome
.AddItem "Positive"
.AddItem "Negative"
End With
cboOutcome.Value = ""
With cboPassageCath
.AddItem "Easy"
.AddItem "Difficult"
End With
cboPassageCath.Value = ""
With cboOutcomeType
.AddItem "Clinical"
.AddItem "Biochemical"
.AddItem "Missed Abortion"
.AddItem "Ectopic"
End With
cboOutcomeType.Value = ""
With cboEmbReplace
.AddItem "Easy"
.AddItem "Difficult"
End With
cboEmbReplace.Value = ""
With cboEmbRepIfDifficult
.AddItem "No Embryo Replacement"
.AddItem "Freeze All"
.AddItem "No fertilisation"
End With
cboEmbRepIfDifficult.Value = ""
With cboIfOHSS
.AddItem "Mild"
.AddItem "Moderate"
.AddItem "Severe"
End With
cboIfOHSS.Value = ""
With cboSpermConcent
.AddItem "Washed concentration"
.AddItem "Washed good progression"
.AddItem "Donor sperm used"
End With
cboSpermConcent.Value = ""
With cboFollicDrainPerform
.AddItem "Yes"
.AddItem "No"
End With
cboFollicDrainPerform.Value = ""
With cboOocytes
.AddItem "Immature"
.AddItem "Mature "
.AddItem "Post mature"
End With
cboOocytes.Value = ""
With cboSourceSperm
.AddItem "Ejaculate"
.AddItem "Donor sperm"
.AddItem "PESA"
.AddItem "TESE"
.AddItem "Stored"
End With
cboSourceSperm.Value = ""
With cboEmbryo
.AddItem "ICSI embryos"
.AddItem "IVF embryos"
.AddItem "ICSI/IVF Split"
End With
cboEmbryo.Value = ""
With cboFHSeen
.AddItem "Yes"
.AddItem "No"
End With
cboFHSeen.Value = ""
With cboOutcomeFetalNumb
.AddItem "Singleton"
.AddItem "Twin"
.AddItem "High order multiple"
End With
cboOutcomeFetalNumb.Value = ""
' Call the Number Search
Call Test
End Sub