well i have been trying to get this thing to store in a database i created in mircosoft db any help would be appreciated. Thank you in advance
Private Sub cmdadd_Click()
optftime.Value = False
optptime.Value = False
optict.Value = False
optassessmentprogramme.Value = False
optdbt.Value = False
opttvet.Value = False
optcarrerdev.Value = False
optictinstruc.Value = False
opteventsmanagement.Value = False
opteduandtranng.Value = False
optcnstrudsitemanagement.Value = False
cboparish.Text = "Select Parish"
Adoaddlec.Recordset.AddNew
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdnext_Click()
Adoaddlec.Recordset.MoveNext
If (Adoaddlec.Recordset.EOF = True) Then
Adoaddlec.Recordset.MoveLast
MsgBox "You are at the last record in the database", vbInformation + vbOKOnly, "Atmoic Inc"
End If
Call status
Call department
Call parish
End Sub
Private Sub cmdprevious_Click()
Adoaddlec.Recordset.MovePrevious
If (Adoaddlec.Recordset.BOF = True) Then
Adoaddlec.Recordset.MoveFirst
MsgBox " You are at the first record in the database", vbInformation + vbOKOnly, "Atmoic Inc"
End If
Call status
Call department
Call parish
End Sub
Private Sub cmdsave_Click()
Dim street As String
street = txtstreet.Text
If (txtlname.Text = "") Then
MsgBox "Last Name is compulsory", vbExclamation + vbOKOnly, "Atmoic Inc"
txtlname.SetFocus
ElseIf (txtfname.Text = "") Then
MsgBox "First Name is compulsory", vbExclamation + vbOKOnly, "Atmoic Inc"
txtfname.SetFocus
ElseIf (optftime.Value = False) And (optptime.Value = False) Then
MsgBox "Please select your status", vbExclamation + vbOKOnly, "Atmoic Inc"
ElseIf (cboparish.Text = "Select Parish") Then
MsgBox "Please select a parish", vbExclamation + vbOKOnly, "Error"
ElseIf (street = "") Then
MsgBox "Street should contain a street address", vbExclamation + vbOKOnly, "Atmoic Inc"
ElseIf (txtphoneno.Text = "") And (txtcellno.Text = "") Then
MsgBox "Work and Cell number is compulsory", vbInformation + vbOKOnly, "Atomic Inc"
ElseIf (optict.Value = False) And (optassessmentprogramme.Value = False) And (optdbt.Value = False) And (opttvet.Value = False) And (optcarrerdev.Value = False) And (optictinstruc.Value = False) And (opteventsmanagement.Value = False) And (opteduandtranng.Value = False) And (optcnstrudsitemanagement.Value = False) Then
MsgBox "Please select your respective department", vbQuestion + vbOKOnly, "Atomic Inc"
Else
If (optftime.Value = True) Then
Adoaddlec.Recordset.Fields("status") = "ft"
ElseIf (optptime.Value = True) Then
Adoaddlec.Recordset.Fields("status") = "pt"
ElseIf (cboparish.Text = "Clarendon") Then
Adoaddlec.Recordset.Fields("parish") = 1
ElseIf (cboparish.Text = "Hanover") Then
Adoaddlec.Recordset.Fields("parish") = 2
ElseIf (cboparish.Text = "Manchester") Then
Adoaddlec.Recordset.Fields("parish") = 3
ElseIf (cboparish.Text = "Portland") Then
Adoaddlec.Recordset.Fields("parish") = 4
ElseIf (cboparish.Text = "St.Andrew") Then
Adoaddlec.Recordset.Fields("parish") = 5
ElseIf (cboparish.Text = "St.Ann") Then
Adoaddlec.Recordset.Fields("parish") = 6
ElseIf (cboparish.Text = "St.Catherine") Then
Adoaddlec.Recordset.Fields("parish") = 7
ElseIf (cboparish.Text = "St.Elizabeth") Then
Adoaddlec.Recordset.Fields("parish") = 8
ElseIf (cboparish.Text = "St.James") Then
Adoaddlec.Recordset.Fields("parish") = 9
ElseIf (cboparish.Text = "St.Mary") Then
Adoaddlec.Recordset.Fields("parish") = 10
ElseIf (cboparish.Text = "St.Thomas") Then
Adoaddlec.Recordset.Fields("parish") = 11
ElseIf (cboparish.Text = "Trelwany") Then
Adoaddlec.Recordset.Fields("parish") = 12
ElseIf (cboparish.Text = "Westmoreland") Then
Adoaddlec.Recordset.Fields("parish") = 13
ElseIf (optict.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 1
ElseIf (optassessmentprogramme.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 2
ElseIf (optdbt.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 3
ElseIf (opttvet.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 4
ElseIf (optcarrerdev.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 5
ElseIf (optictinstruc.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 6
ElseIf (opteventsmanagement.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 7
ElseIf (opteduandtranng.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 8
ElseIf (optcnstrudsitemanagement.Value = True) Then
Adoaddlec.Recordset.Fields("department") = 9
End If
Adoaddlec.Recordset.Update
MsgBox "Record Updates", , "Atomic Inc"
End If
End Sub
Private Sub Form_Load()
Call status
Call department
Call parish
End Sub
Private Sub status()
Dim stat_us As String
stat_us = Trim(Adoaddlec.Recordset.Fields("status"))
If (stat_us = "ft") Then
optftime.Value = True
ElseIf (stat_us = "pt") Then
optptime.Value = True
End If
End Sub
Private Sub department()
Dim dep As Variant
dep = Trim(Adoaddlec.Recordset.Fields("department"))
If (dep = 1) Then
optict.Value = True
ElseIf (dep = 2) Then
optassessmentprogramme.Value = True
ElseIf (dep = 3) Then
optdbt.Value = True
ElseIf (dep = 4) Then
opttvet.Value = True
ElseIf (dep = 5) Then
optcarrerdev.Value = True
ElseIf (dep = 6) Then
optictinstruc.Value = True
ElseIf (dep = 7) Then
opteventsmanagement.Value = True
ElseIf (dep = 8) Then
opteduandtranng.Value = True
ElseIf (dep = 9) Then
optcnstrudsitemanagement.Value = True
End If
End Sub
Private Sub parish()
Dim par As Variant
par = Trim(Adoaddlec.Recordset.Fields("parish"))
If (par = 1) Then
cboparish.Text = "Clarendon"
ElseIf (par = 2) Then
cboparish.Text = "Hanover"
ElseIf (par = 3) Then
cboparish.Text = "Manchester"
ElseIf (par = 4) Then
cboparish.Text = "Portland"
ElseIf (par = 5) Then
cboparish.Text = "St.Andrew"
ElseIf (par = 6) Then
cboparish.Text = "St.Ann"
ElseIf (par = 7) Then
cboparish.Text = "St.Catherine"
ElseIf (par = 8) Then
cboparish.Text = "St.Elizabeth"
ElseIf (par = 9) Then
cboparish.Text = "St.James"
ElseIf (par = 10) Then
cboparish.Text = "St.Mary"
ElseIf (par = 11) Then
cboparish.Text = "St.Thomas"
ElseIf (par = 12) Then
cboparish.Text = "Trelwany"
ElseIf (par = 13) Then
cboparish.Text = "Westmoreland"
End If
End Sub