📄 frmuserparticulars.frm
字号:
Private Sub cmdsave1_Click()
deactivetodBase
End Sub
Private Sub cmdsave2_Click()
Status = MsgBox("Are you sure you want to update the record", vbYesNo + vbInformation, "Update Record")
If Status = vbYes Then
Dim getstatus As String, active As Boolean
If datuserdetails.Recordset.Fields("Active") = "False" Then
getstatus = MsgBox("The User Is Not Active Would You Like To Activate His/Her Status", vbYesNo + vbInformation, "Active Status")
If getstatus = vbYes Then
datuserdetails.Recordset.Edit
active = True
datuserdetails.Recordset.Fields("Active") = active
gendertodatabase
datuserdetails.Recordset.Update
lblactive.Caption = "Yes"
disable
cmdsave2.Visible = False
cmdupdate.Visible = True
ElseIf getstats = vbNo Then
datuserdetails.Recordset.Edit
gendertodatabase
datuserdetails.Recordset.Update
disable
cmdsave2.Visible = False
cmdupdate.Visible = True
End If
ElseIf datuserdetails.Recordset.Fields("Active") = "True" Then
getstatus = MsgBox("The User Is Active Would You Like To Deactivate His\Her Status", vbYesNo + vbInformation, "Active Status")
If getstatus = vbYes Then
datuserdetails.Recordset.Edit
active = False
datuserdetails.Recordset.Fields("Active") = active
gendertodatabase
datuserdetails.Recordset.Update
lblactive.Caption = "No"
disable
cmdsave2.Visible = False
cmdupdate.Visible = True
Else
datuserdetails.Recordset.Edit
gendertodatabase
datuserdetails.Recordset.Update
disable
cmdsave2.Visible = False
cmdupdate.Visible = True
End If
End If
ElseIf Status = vbNo Then
disable
cmdsave2.Visible = False
cmdupdate.Visible = True
End If
End Sub
Private Sub cmdsearch_Click()
search
End Sub
Private Sub cmdUpdate_Click()
UpdateRecord
End Sub
Private Sub Form_Activate()
getgender
getactive
End Sub
Private Sub Form_Load()
disable
cmdsave.Enabled = False
cmdCancel.Enabled = False
cmdCancel.Visible = True
cmdsave1.Visible = False
'getgender
End Sub
Private Sub movenext()
'Dim gender As String
If datuserdetails.Recordset.EOF = True Then
datuserdetails.Recordset.MoveLast
MsgBox ("This is the Last Record")
Else
datuserdetails.Recordset.movenext
If datuserdetails.Recordset.EOF = True Then
datuserdetails.Recordset.MoveLast
MsgBox ("This is The Last Record")
End If
End If
getgender
getactive
End Sub
Private Sub moveprevious()
'Dim gender As String
If datuserdetails.Recordset.BOF = True Then
datuserdetails.Recordset.MoveFirst
MsgBox ("This is the First Record")
Else
datuserdetails.Recordset.moveprevious
If datuserdetails.Recordset.BOF = True Then
datuserdetails.Recordset.MoveFirst
MsgBox ("This is The First Record")
End If
End If
getgender
getactive
End Sub
Private Sub addnew()
Static bookmark As String
cmdupdate.Enabled = False
lblactive.Caption = "Yes"
bookmark = txtuserid.Text
cmdsearch.Enabled = False
txtuserfn.Enabled = True
txtusersn.Enabled = True
txtusertn.Enabled = True
'txtuserid.Enabled = True
txtuseraddress.Enabled = True
txtcity.Enabled = True
txtcountry.Enabled = True
txtuserdate.Enabled = True
txtproffession.Enabled = True
cmdaddnew.Enabled = False
cmddiscontinue.Enabled = False
Dim gender As String
Dim active As Boolean
cmdnext.Enabled = False
cmdprevious.Enabled = False
'cmddelete.Enabled = False
cmdsave.Enabled = True
Dim admno As Long
admno = 1
'cmdCancel.Visible = True
cmdCancel.Enabled = True
datuserdetails.Recordset.MoveFirst
Do While Not datuserdetails.Recordset.EOF
'admno = datuserdetails.Recordset.Fields("studentID")
admno = admno + 1
datuserdetails.Recordset.movenext
Loop
datuserdetails.Recordset.addnew
'txtuserid.Enabled = True
'txtuseraddress.Text = "P.O.Box"
txtuserid.Text = "FBCC\Users\" & admno
'txtuserid.Text = admno
End Sub
Private Sub cancel()
datuserdetails.Recordset.CancelUpdate
'If datuserdetails.Recordset.EditMode = dbEditAdd Then
'datuserdetails.Recordset.CancelUpdate
'End If
datuserdetails.Recordset.MoveFirst
If Trim(bookmark) <> "" Then
find = "studentID ='" + find + "'"
getgender
datuserdetails.Recordset.FindNext find
End If
bookmark = ""
cmddiscontinue.Enabled = True
cmdnext.Enabled = True
cmdprevious.Enabled = True
cmdaddnew.Enabled = True
cmdsave.Enabled = False
cmdCancel.Enabled = False
cmdupdate.Enabled = True
cmdsearch.Enabled = True
disable
'cmdcancel.Visible = False
End Sub
Private Sub Save()
Dim gender As String
'check wether the record is complete
If txtuserfn = "" Then
MsgBox ("Some Information is missing")
Exit Sub
ElseIf txtusersn = "" Then
MsgBox ("Some Information is missing")
Exit Sub
ElseIf txtusertn = "" Then
MsgBox ("Some Information is missing")
Exit Sub
ElseIf txtuseraddress = "" Then
MsgBox ("Some Information is missing")
Exit Sub
ElseIf txtproffession = "" Then
MsgBox ("Some Information is missing")
Exit Sub
Else:
gendertodatabase
activetodBase
cmdsearch.Enabled = True
cmdnext.Enabled = True
cmdprevious.Enabled = True
cmdaddnew.Enabled = True
cmdsave.Enabled = False
cmddiscontinue.Enabled = True
disable
cmdCancel.Enabled = False
cmdupdate.Enabled = True
End If
End Sub
Private Sub mnuaddnew_Click()
addnew
End Sub
Private Sub mnubookinfo_Click()
frmBookinfo.Show
End Sub
Private Sub mnuborrow_Click()
frmborrowing.Show
End Sub
Private Sub mnuborrowed_Click()
frmbookborrowing_return.Show
End Sub
Private Sub mnucancel_Click()
cancel
End Sub
Private Sub mnudiscontinue_Click()
cont_disc
End Sub
Private Sub mnuexit1_Click()
exitsure
End Sub
Private Sub mnufirst_Click()
datuserdetails.Recordset.MoveFirst
End Sub
Private Sub mnuhorizontal_Click()
mdilibrary.Arrange vbTileHorizontal
End Sub
Private Sub mnulast_Click()
datuserdetails.Recordset.MoveLast
End Sub
Private Sub mnumovenext_Click()
movenext
End Sub
Private Sub mnuprevious_Click()
moveprevious
End Sub
Private Sub mnureport_Click()
Load frmReport
frmReport.Show
End Sub
Private Sub mnuReturn_Click()
frmreturning.Show
End Sub
Private Sub mnusave_Click()
Save
End Sub
Private Sub mnusearch_Click()
search
End Sub
Private Sub mnuvertical_Click()
mdilibrary.Arrange vbTileVertical
End Sub
Private Sub search()
Dim a, b, find
find = InputBox("the user ID", , "find")
datuserdetails.Recordset.MoveFirst
If Trim(find) <> "" Then
find = "studentFName ='" + find + "'"
getgender
datuserdetails.Recordset.FindNext find
Else ' if no input display this information
a = MsgBox("you must give a name", vbInformation, "User ID")
End If
'if no match display this message
If datuserdetails.Recordset.NoMatch Then
b = MsgBox("no such name", vbInformation, "User ID not found")
End If
End Sub
Private Sub getgender()
gender = datuserdetails.Recordset.Fields("gender")
If gender = "Yes" Then
optmale.value = True
Else: optfemale.value = True
End If
End Sub
Private Sub disable()
txtuserfn.Enabled = False
txtusersn.Enabled = False
txtusertn.Enabled = False
txtuserid.Enabled = False
txtuseraddress.Enabled = False
txtcity.Enabled = False
txtcountry.Enabled = False
txtuserdate.Enabled = False
txtproffession.Enabled = False
End Sub
Private Sub gendertodatabase()
Dim gender1 As String
If optmale.value = True Then
gender1 = "Yes"
Else:
gender1 = "No"
End If
datuserdetails.Recordset.Fields("gender") = gender1
End Sub
Private Sub exitsure()
Dim exits As Integer
exits = MsgBox("Do You Really Want to Exit", vbYesNoCancel + vbInformation, "Exit")
If cmdaddnew.Enabled = False And exits = vbYes Then
cancel
Unload Me
ElseIf cmdaddnew.Enabled = True And exits = vbYes Then
Unload Me
ElseIf exits = vbNo And cmdaddnew.Enabled = False Then
cancel
'datbook.Recordset.MoveLast
'ElseIf exits = vbNo And cmdnew.Enabled = True Then
Else
'do nothing
End If
End Sub
Private Sub discontinueuser()
Dim find As String, a, b
find = InputBox("Enter the User Name Please", , "find")
datuserdetails.Recordset.MoveFirst
If Trim(find) <> "" Then
find = "studentFName ='" + find + "'"
getgender
datuserdetails.Recordset.FindNext find
ElseIf find <> "" Then ' if no input display this information
a = MsgBox("you must give a name", vbInformation, "User ID")
cmdsave1.Visible = False
End If
'if no match display this message
If datuserdetails.Recordset.NoMatch Then
b = MsgBox("no such name", vbInformation, "User Name not found")
cmdsave1.Visible = False
End If
End Sub
Private Sub activetodBase()
Dim active As Boolean
active = True
datuserdetails.Recordset.Fields("Active") = active
End Sub
Private Sub getactive()
Dim active As Boolean
active = datuserdetails.Recordset.Fields("Active")
If active = True Then
lblactive.Caption = "Yes"
Else
lblactive.Caption = "No"
End If
End Sub
Private Sub deactivetodBase()
'deactivate user info is sent to the database
Dim active As Boolean
active = False
datuserdetails.Recordset.Edit
datuserdetails.Recordset.Fields("Active") = active
datuserdetails.Recordset.Update
cmdsave1.Visible = False
lblactive.Caption = "No"
End Sub
Private Sub UpdateRecord()
cmdupdate.Visible = False
txtuserfn.Enabled = True
txtusersn.Enabled = True
txtusertn.Enabled = True
'txtuserid.Enabled = True
txtuseraddress.Enabled = True
txtcity.Enabled = True
txtcountry.Enabled = True
txtuserdate.Enabled = True
txtproffession.Enabled = True
cmdsave2.Visible = True
End Sub
Private Sub cont_disc()
Status = MsgBox("Are you sure you want to update the record", vbYesNo + vbInformation, "Update Record")
If Status = vbYes Then
Dim getstatus As String, active As Boolean
If datuserdetails.Recordset.Fields("Active") = "False" Then
getstatus = MsgBox("The User Is Not Active Would You Like To Activate His/Her Status", vbYesNo + vbInformation, "Active Status")
If getstatus = vbYes Then
datuserdetails.Recordset.Edit
active = True
datuserdetails.Recordset.Fields("Active") = active
datuserdetails.Recordset.Update
lblactive.Caption = "Yes"
disable
cmdsave1.Visible = False
ElseIf getstats = vbNo Then
datuserdetails.Recordset.Edit
datuserdetails.Recordset.Update
cmdsave1.Visible = False
End If
ElseIf datuserdetails.Recordset.Fields("Active") = "True" Then
getstatus = MsgBox("The User Is Active Would You Like To Deactivate His\Her Status", vbYesNo + vbInformation, "Active Status")
If getstatus = vbYes Then
datuserdetails.Recordset.Edit
active = False
datuserdetails.Recordset.Fields("Active") = active
datuserdetails.Recordset.Update
lblactive.Caption = "No"
cmdsave1.Visible = False
Else
cmdsave1.Visible = False
End If
End If
ElseIf Status = vbNo Then
cmdsave1.Visible = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -