📄 general.bas
字号:
Attribute VB_Name = "general"
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'This library project is created by Vipin Panicker. E-Mail: itsvipin@hotmail.com
Function Check() As Boolean
With Issue
Check = False
If .txtRollno.Text = "" Then
MsgBox "Enter Student's Roll No."
.txtRollno.SetFocus
Else
If .Txtbkno.Text = "" Then
MsgBox "Enter Book's No."
.Txtbkno.SetFocus
Else
Check = True
End If
End If
End With
End Function
Function FillBkissued() As String
With Issue.CountData.Recordset
FillBkissued = 0
If Not .RecordCount = 0 Then
.MoveFirst
While .EOF = False
If .Fields("nrollno") = Issue.txtRollno.Text Then
FillBkissued = .Fields("numbers")
Exit Function
Else
.MoveNext
End If
Wend
End If
End With
End Function
Function FillStuname() As String
With Issue.StuinfoData.Recordset
.MoveFirst
FillStuname = "No Student found."
While .EOF = False
If .Fields("nrollno") = Issue.txtRollno.Text Then
FillStuname = .Fields("tstuname")
Exit Function
Else
.MoveNext
End If
Wend
End With
End Function
Function FillBknamegrp(temp() As String)
With Issue.BookinfoData.Recordset
.MoveFirst
temp(1) = "No Book Found."
While .EOF = False
If .Fields("nbookno") = Issue.Txtbkno.Text Then
temp(1) = .Fields("tbookname")
temp(2) = .Fields("tbookgroup")
Exit Function
Else
.MoveNext
End If
Wend
End With
End Function
Function Saaf(temp As Object)
With temp
.Txtstuname.Text = ""
.Txtbkno.Text = ""
.txtRollno.Text = ""
.txtBkissued.Text = ""
.Txtbkname.Text = ""
.txtBkGroup.Text = ""
.txtRollno.SetFocus
End With
End Function
Function Depositb()
Dim Check As Boolean 'checking whether the given book no or Stuname really exists.
With Deposit.DepositData
.Refresh
If Not .Recordset.RecordCount = 0 Then
.Recordset.MoveFirst
While .Recordset.EOF = False
If .Recordset.Fields("nbookno") = Deposit.Txtbkno.Text Then
If .Recordset.Fields("nrollno") = Deposit.txtRollno.Text Then
Call general.filldpstdate
.Recordset.Delete
MsgBox "Book Deposited.", vbOKOnly, "Deposited"
Check = True
Exit Function
Else
MsgBox "This book was not issued to this student."
Exit Function
End If
Else
.Recordset.MoveNext
End If
Wend
Else
MsgBox "No book issued to anyone."
End If
End With
If Check = False Then
MsgBox "This Book is in Library or doesn't exists."
End If
End Function
Function DepositfillStuname() As String
With Issue.StuinfoData.Recordset
.MoveFirst
DepositfillStuname = "No Student found."
While Issue.StuinfoData.Recordset.EOF = False
If .Fields("nrollno") = Deposit.txtRollno.Text Then
DepositfillStuname = .Fields("tstuname")
Exit Function
Else
.MoveNext
End If
Wend
End With
End Function
Function DpstfillBkissued() As String
With Issue.CountData.Recordset
DpstfillBkissued = 0
If Not .RecordCount = 0 Then
.MoveFirst
While .EOF = False
If .Fields("nrollno") = Deposit.txtRollno.Text Then
DpstfillBkissued = .Fields("numbers")
Exit Function
Else
.MoveNext
End If
Wend
End If
End With
End Function
Function filldpstdate()
If Not Issue.RecordData.Recordset.RecordCount = 0 Then
While Issue.RecordData.Recordset.EOF = False
If Issue.RecordData.Recordset.Fields("nbkno") = Deposit.Txtbkno.Text Then
Issue.RecordData.Recordset.Edit
Issue.RecordData.Recordset.Fields("deposit") = Deposit.txtDate.Text
Issue.RecordData.Recordset.Update
Exit Function
Else
Issue.RecordData.Recordset.MoveNext
End If
Wend
End If
End Function
Function FillBknamegrpD(temp() As String)
With Issue.BookinfoData.Recordset
.MoveFirst
temp(1) = "No Book Found."
While .EOF = False
If .Fields("nbookno") = Deposit.Txtbkno.Text Then
temp(1) = .Fields("tbookname")
temp(2) = .Fields("tbookgroup")
Exit Function
Else
.MoveNext
End If
Wend
End With
End Function
Function ghadi() As String
Dim p As String
p = Day(Date) & "-" & MonthName(Month(Date)) & "-" & Year(Date)
ghadi = p
End Function
Function addstudent()
On Error GoTo msg
If Addstu.Cmdadd.Caption = "Add Student" Then
Addstu.Data1.Recordset.AddNew
Addstu.Cmdadd.Caption = "Save"
Addstu.Txtrno.SetFocus
Addstu.Txtrno.Text = ""
Else
If Addstu.Cmdadd.Caption = "Save" Then
Addstu.Data1.Recordset.Update
Addstu.Cmdadd.Caption = "Add Student"
End If
End If
msg:
If Err.Number = 3022 Then
MsgBox "The roll no. already exists."
Addstu.Txtrno.SetFocus
End If
If Err.Number = 3426 Then
MsgBox "Enter correct format of Roll No."
End If
End Function
Function Bookadd()
On Error GoTo msg
If AddBook.Cmdadd.Caption = "Add Book" Then
AddBook.Data1.Recordset.AddNew
AddBook.Cmdadd.Caption = "Save"
AddBook.Txtbkno.SetFocus
AddBook.Txtbkno.Text = ""
Else
If AddBook.Cmdadd.Caption = "Save" Then
AddBook.Data1.Recordset.Update
AddBook.Data1.Refresh
AddBook.Cmdadd.Caption = "Add Book"
End If
End If
msg:
If Err.Number = 3022 Then
MsgBox "The Book No. already exists."
AddBook.Txtbkno.SetFocus
End If
If Err.Number = 3426 Then
MsgBox "Enter correct format of Book No."
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -