| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 
 | Private Sub Cmdbutton_Add_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("CONTACT LIST")
 
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
 
'check for a Name number
If Trim(Me.textbox_Name.Value) = "" Then
Me.textbox_Name.SetFocus
MsgBox "Please complete the form"
End If
 
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.ComboBox_reference.Value
ws.Cells(iRow, 2).Value = Me.ComboBox_Status.Value
ws.Cells(iRow, 3).Value = Me.TextBox_Lastupdate.Value
ws.Cells(iRow, 4).Value = Me.textbox_Company.Value
ws.Cells(iRow, 5).Value = Me.ComboBox_Activity.Value
ws.Cells(iRow, 6).Value = Me.ComboBox_BYOB.Value
ws.Cells(iRow, 7).Value = Me.ComboBox_Position.Value
ws.Cells(iRow, 8).Value = Me.ComboBox_Category.Value
ws.Cells(iRow, 9).Value = Me.ComboBox_Topic.Value
ws.Cells(iRow, 10).Value = Me.ComboBox_Code.Value
ws.Cells(iRow, 11).Value = Me.ComboBox_Language.Value
ws.Cells(iRow, 12).Value = Me.ComboBox_Title.Value
ws.Cells(iRow, 13).Value = Me.textbox_Name.Value
ws.Cells(iRow, 14).Value = Me.textbox_Surname.Value
ws.Cells(iRow, 15).Value = Me.textbox_Address.Value
ws.Cells(iRow, 16).Value = Me.textbox_Suite.Value
ws.Cells(iRow, 17).Value = Me.textbox_City.Value
ws.Cells(iRow, 18).Value = Me.textbox_Postalcode.Value
ws.Cells(iRow, 19).Value = Me.textbox_Province.Value
ws.Cells(iRow, 20).Value = Me.textbox_Country.Value
ws.Cells(iRow, 21).Value = Me.textbox_Phone1.Value
ws.Cells(iRow, 22).Value = Me.textbox_Phone2.Value
ws.Cells(iRow, 23).Value = Me.textbox_Email1.Value
ws.Cells(iRow, 24).Value = Me.textbox_Email2.Value
ws.Cells(iRow, 25).Value = Me.textbox_Fax.Value
ws.Cells(iRow, 26).Value = Me.textbox_Website.Value
ws.Cells(iRow, 27).Value = Me.textbox_Facebook.Value
ws.Cells(iRow, 28).Value = Me.textbox_Twitter.Value
ws.Cells(iRow, 29).Value = Me.textbox_Blog.Value
ws.Cells(iRow, 30).Value = Me.TextBox_Comments.Value
MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
 
'clear the data
Me.ComboBox_reference.Value = ""
Me.ComboBox_Status.Value = ""
Me.TextBox_Lastupdate.Value = ""
Me.textbox_Company.Value = ""
Me.ComboBox_Activity.Value = ""
Me.ComboBox_BYOB.Value = ""
Me.ComboBox_Position.Value = ""
Me.ComboBox_Category.Value = ""
Me.ComboBox_Topic.Value = ""
Me.ComboBox_Code.Value = ""
Me.ComboBox_Language.Value = ""
Me.ComboBox_Title.Value = ""
Me.textbox_Name.Value = ""
Me.textbox_Surname.Value = ""
Me.textbox_Address.Value = ""
Me.textbox_Suite.Value = ""
Me.textbox_City.Value = ""
Me.textbox_Postalcode.Value = ""
Me.textbox_Province.Value = ""
Me.textbox_Country.Value = ""
Me.textbox_Phone1.Value = ""
Me.textbox_Phone2.Value = ""
Me.textbox_Email1.Value = ""
Me.textbox_Email2.Value = ""
Me.textbox_Fax.Value = ""
Me.textbox_Website.Value = ""
Me.textbox_Facebook.Value = ""
Me.textbox_Twitter.Value = ""
Me.textbox_Blog.Value = ""
Me.TextBox_Comments.Value = ""
Me.textbox_Name.SetFocus
End Sub
 
Private Sub Cmdbutton_Close_Click()
Unload Me
End Sub
 
Private Sub ListBox1_Click()
ComboBox1.List = Worksheets("Sheet1").Range("I1:I50").Value
End Sub
 
 
Private Sub ComboBox_Search_Change()
 
End Sub
 
Private Sub ComboBox1_Change()
 
End Sub
 
Private Sub ComboBox_reference_Change()
 
End Sub
 
Private Sub CommandButton_Update_Click()
Dim no_ligne As Integer
Sheets("CONTACT LIST").Select
no_ligne = ComboBox_reference.ListIndex + 1
If ComboBox_reference.Value = "" Then
MsgBox ("Update data")
Else
Cells(no_ligne, 1) = ComboBox_reference.Value
Cells(no_ligne, 2) = ComboBox_Status.Value
Cells(no_ligne, 3) = TextBox_Lastupdate.Value
Cells(no_ligne, 4) = textbox_Company.Value
Cells(no_ligne, 5) = ComboBox_Activity.Value
Cells(no_ligne, 6) = ComboBox_BYOB.Value
Cells(no_ligne, 7) = ComboBox_Position.Value
Cells(no_ligne, 8) = ComboBox_Category.Value
Cells(no_ligne, 9) = ComboBox_Topic.Value
Cells(no_ligne, 10) = ComboBox_Code.Value
Cells(no_ligne, 11) = ComboBox_Language.Value
Cells(no_ligne, 12) = ComboBox_Title.Value
Cells(no_ligne, 13) = textbox_Name.Value
Cells(no_ligne, 14) = textbox_Surname.Value
Cells(no_ligne, 15) = textbox_Address.Value
Cells(no_ligne, 16) = textbox_Suite.Value
Cells(no_ligne, 17) = textbox_City.Value
Cells(no_ligne, 18) = textbox_Postalcode.Value
Cells(no_ligne, 19) = textbox_Province.Value
Cells(no_ligne, 20) = textbox_Country.Value
Cells(no_ligne, 21) = textbox_Phone1.Value
Cells(no_ligne, 22) = textbox_Phone2.Value
Cells(no_ligne, 23).Value = Me.textbox_Email1.Value
Cells(no_ligne, 24).Value = Me.textbox_Email2.Value
Cells(no_ligne, 25).Value = Me.textbox_Fax.Value
Cells(no_ligne, 26).Value = Me.textbox_Website.Value
Cells(no_ligne, 27).Value = Me.textbox_Facebook.Value
Cells(no_ligne, 28).Value = Me.textbox_Twitter.Value
Cells(no_ligne, 29).Value = Me.textbox_Blog.Value
Cells(no_ligne, 30).Value = Me.TextBox_Comments.Value
End If
End Sub
 
 
Private Sub CommandButton_search_Click()
Dim no_ligne As Integer
no_ligne = ComboBox_reference.ListIndex + 1
ComboBox_reference.Value = Cells(no_ligne, 1).Value
ComboBox_Status.Value = Cells(no_ligne, 2).Value
TextBox_Lastupdate.Value = Cells(no_ligne, 3).Value
textbox_Company.Value = Cells(no_ligne, 4).Value
ComboBox_Activity.Value = Cells(no_ligne, 5).Value
ComboBox_BYOB.Value = Cells(no_ligne, 6).Value
ComboBox_Position.Value = Cells(no_ligne, 7).Value
ComboBox_Category.Value = Cells(no_ligne, 8).Value
ComboBox_Topic.Value = Cells(no_ligne, 9).Value
ComboBox_Code.Value = Cells(no_ligne, 10).Value
ComboBox_Language.Value = Cells(no_ligne, 11).Value
ComboBox_Title.Value = Cells(no_ligne, 12).Value
textbox_Name.Value = Cells(no_ligne, 13).Value
textbox_Surname.Value = Cells(no_ligne, 14).Value
textbox_Address.Value = Cells(no_ligne, 15).Value
textbox_Suite.Value = Cells(no_ligne, 16).Value
textbox_City.Value = Cells(no_ligne, 17).Value
textbox_Postalcode.Value = Cells(no_ligne, 18).Value
textbox_Province.Value = Cells(no_ligne, 19).Value
textbox_Country.Value = Cells(no_ligne, 20).Value
textbox_Country.Value = Cells(no_ligne, 21).Value
textbox_Country.Value = Cells(no_ligne, 22).Value
textbox_Country.Value = Cells(no_ligne, 23).Value
textbox_Country.Value = Cells(no_ligne, 24).Value
textbox_Country.Value = Cells(no_ligne, 25).Value
textbox_Country.Value = Cells(no_ligne, 26).Value
textbox_Country.Value = Cells(no_ligne, 27).Value
textbox_Country.Value = Cells(no_ligne, 28).Value
textbox_Country.Value = Cells(no_ligne, 29).Value
textbox_Country.Value = Cells(no_ligne, 30).Value
End Sub
 
Private Sub Label1_Click()
 
End Sub
 
Private Sub textbox_City_Change()
textbox_City.Value = UCase(textbox_City.Value)
End Sub
 
Private Sub textbox_Company_Change()
textbox_Company.Value = UCase(textbox_Company.Value)
End Sub
 
Private Sub textbox_Company_Enter()
textbox_Company.Value = UCase(textbox_Company.Value)
End Sub
 
Private Sub TextBox_Lastupdate_Enter()
TextBox_Lastupdate.Text = Format(TextBox_Lastupdate.Value, "dd/mm/yyyy")
End Sub
 
Private Sub textbox_Province_Change()
textbox_Province.Value = UCase(textbox_Province.Value)
End Sub
 
Private Sub UserForm_Initialize()
Me.ScrollBars = fmScrollBarsVertical
Me.ScrollHeight = Me.InsideHeight * 2
End Sub |