Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

library

Attribute VB_Name = "Module1"


Public myconection As New ADODB.Connection
Public rs As New ADODB.Recordset
Private Sub main()
myconection.ConnectionString = "user ID=scott;password=tiger;Data
Source=odsn"
myconection.Open
If myconection.State = adStateOpen Then
Form2.Show
Else
MsgBox "Error"
End If
End Sub
Public Function inserting(strsql As String)
If rs.State = 1 Then rs.Close
rs.Open strsql, myconection
End Function
Public Function retbook(strsql As String)
If rs.State = 1 Then rs.Close
rs.Open strsql, myconection, adOpenKeyset, adLockOptimistic
If rs.EOF Then
MsgBox ("Enter Valid Book Number")
Else

Form2.Text9.Text = rs!bname
Form2.Text4.Text = rs!aname
Form2.Text5.Text = rs!avbl
If (rs!takenby = Null And rs!datetkn = Null) Then
Form2.Text6.Text = ""
Form2.Text2.Text = ""
Else
Form2.Text6.Text = rs!takenby
Form2.Text2.Text = rs!datetkn

End If
End If
End Function

Form 2
Private Sub Command2_Click()
Form2.Visible = False
Form3.Visible = True
End Sub

Private Sub Command1_Click()


If (Text5.Text = "no") Then
inserting "update book set
avbl='yes',takenby='',datetkn=''" & " where bno='" & Text1.Text & "'"
MsgBox ("Book Returned")
Else
MsgBox ("Invalid Operation")
End If
End Sub

1
library

Private Sub Command3_Click()


If (Text5.Text = "no") Or (Text5.Text = "") Then
MsgBox ("Book is assigned to other person")
Else
inserting "update book set avbl='no',takenby='" & Text6.Text &
"',datetkn='" & Text2.Text & "' where bno='" & Text1.Text & "'"
End If

End Sub

Private Sub Command5_Click()


retbook "select * from book where bno='" & Text1.Text & "'"
End Sub

Form3
Private Sub Command1_Click()
Form3.Visible = False
Form2.Show

End Sub

Private Sub Command2_Click()


DataReport1.Show
End Sub

You might also like