Public Sub UserForm_Initialize()
'Stop
Dim l_mr As Long
Dim temp_ws As Worksheet
Dim CH As Integer
Dim df1 As Integer
Dim test_mr
Dim ai_typelist As String
Dim lrow_a, lrow_p As Integer
Dim Cl As Range
'Set temp_ws = Workbooks("schedule.csv").Worksheets("temp_ws")
mbevents = False
CH = 0 'reset customer information change holder (0=no change, 1=change)
If Application.WorksheetFunction.Count(ws_vh.Range("L:M")) > 0 Then 'mri=true
TextBox1.Visible = False
MsgBox "Combobox enabled."
mri = True 'missing rental flag
' Stop
End If
If l_mr <> 1 Then uf2_eliminate.Visible = False 'NO MISSING RECORDS
If df1 < 4 Then uf2_eliminate.Visible = True
Label34.Caption = " Please enter valid permit number."
proceed1.Enabled = True
cmdb_agrmnt.Enabled = False
submit1.Enabled = False
delete1.Enabled = False
edit1.Enabled = False
amm_no.Value = 0
amm_no.Locked = True
date1.Value = Format(Date, "dd-mmm")
date1.Locked = True
ai_type.Value = ""
ai_type.List = Workbooks("Rental_Detail.xlsm").Names("ai_typelist").RefersToRange.Value
'ai_type.List = = Workbooks("Rental_Detail")
ai_type.BackColor = RGB(0, 126, 167) 'celadon blue
ai_function.BackColor = RGB(255, 255, 255)
ai_function.Value = ""
ai_function.Enabled = False
ai_league.Value = ""
ai_league.Enabled = False
ai_calibre.Value = ""
ai_calibre.Enabled = False
ai_division.Value = ""
ai_division.Enabled = False
ai_event.Value = ""
ai_event.Enabled = False
'baseball
ai_basedist.Value = ""
ai_basedist.Locked = True
ai_pitchdist.Value = ""
ai_pitchdist.Locked = True
ai_bbox.Value = ""
ai_bbox.Locked = True
ai_safety.Value = ""
ai_safety.Locked = True
ai_circle.Value = ""
ai_circle.Locked = True
ai_mat.Value = ""
ai_mat.Locked = True
ai_safeline.Value = ""
ai_safeline.Locked = True
ai_commit.Value = ""
ai_commit.Locked = True
ai_runline.Value = ""
ai_runline.Locked = True
ai_other1.Value = ""
ai_other1.Locked = True
ai_other2.Value = ""
ai_other2.Locked = True
ai_comment = ""
'courts
ai_setup.Value = ""
ai_setup.Locked = True
ai_other3.Value = ""
ai_other3.Locked = True
ai_other4.Value = ""
ai_other4.Locked = True
'fields
ai_layout.Value = ""
ai_layout.Locked = True
ai_goals.Value = ""
ai_goals.Locked = True
ai_other5.Value = ""
ai_other5.Locked = True
ai_other6.Value = ""
ai_other6.Locked = True
'greenspace
ai_water.Value = False
ai_water.Locked = True
ai_hydro.Value = False
ai_hydro.Locked = True
ai_attendance = 0
ai_tables = 0
ci_league.Locked = True
ci_affiliated.Value = "N"
ci_affiliated.Locked = True
ci_affiliated.BackColor = RGB(255, 255, 255)
'primary name
ci_name1.Value = ""
ci_name1.Locked = True
ci_name1.BackColor = RGB(255, 255, 255)
ci_email1.Value = ""
ci_email1.Locked = True
ci_email1.BackColor = RGB(255, 255, 255)
ci_tele1a.Value = Format(0, "000.000.0000")
ci_tele1a.BackColor = RGB(255, 255, 255)
ci_tele1a.Locked = True
ci_tele1b.Value = Format(0, "000.000.0000")
ci_tele1b.BackColor = RGB(255, 255, 255)
ci_tele1b.Locked = True
'secondary name
ci_name2.Value = ""
ci_name2.Locked = True
ci_name2.BackColor = RGB(255, 255, 255)
ci_email2.Value = ""
ci_email2.Locked = True
ci_email2.BackColor = RGB(255, 255, 255)
ci_tele2a.Value = Format(0, "000.000.0000")
ci_tele2a.BackColor = RGB(255, 255, 255)
ci_tele2a.Locked = True
ci_tele2b.Value = Format(0, "000.000.0000")
ci_tele2b.BackColor = RGB(255, 255, 255)
ci_tele2b.Locked = True
MultiPage1.Value = 1
MultiPage1.Visible = False
MultiPage2.Value = 0
Frame8.Visible = False
group_1.Height = 124.5
'If Application.WorksheetFunction.Count(ws_vh.Range("L:M")) = 0 Then
If mri = True Then
With CreateObject("scripting.dictionary")
For Each Cl In ws_vh.Columns("L:M").SpecialCells(xlConstants, xlNumbers)
If Cl <> "" Then .Item(Cl.Value) = Empty
Next Cl
Me.cb_mri.List = .Keys
Me.cb_mri.ListIndex = 0
If .Count = 1 Then Me.cb_mri.Locked = True
End With
cb_mri.BackColor = RGB(0, 168, 232)
Label34.Caption = " Select missing rental."
Else
With TextBox1 'rental number
cb_mri.Visible = False
.Locked = False
.BackColor = RGB(255, 255, 255)
.Value = Format(0, "000000") 'new rental
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
mbevents = True
End Sub