Professional Documents
Culture Documents
Library Coding
Library Coding
Exit Sub
End If
strq = "insert into issue values('" & Create_ID & "','" & Text1 & "','" &
Text2 & "','" & _
IssueDate & "','" & ReturnDate & "','" & "I" & "')"
conn.Execute strq
strq = "Update BookMaster set status='I' where bookno=" & Text1 & ""
conn.Execute strq
strq = "Update MemberMaster set status='B' where memno=" & Text2 & ""
conn.Execute strq
End Sub
Private Function Create_ID() As String
strq = "select max(id) from issue"
If rs.State = adStateOpen Then
rs.Close
End If
rs.Open strq, conn, 1, 2
If IsNull(rs(0)) = True Then
Create_ID = "1"
Else
Create_ID = Trim(Str(rs(0) + 1))
End If
End Function
Private Sub clear_TextBox()
Dim ctl As Control
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next
For Each ctl In Controls
If TypeOf ctl Is MaskEdBox Then
ctl.Mask = ""
ctl.Text = ""
ctl.Mask = "##/##/####"
End If
Next
End Sub
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
Private Sub Text1_LostFocus()
If Trim(Text1) <> "" Then
strq = "select * from membermaster where memno=" & Text1 & ""
If rs.State = adStateOpen Then rs.Close
rs.Open strq, conn, 1, 2
If rs.RecordCount = 0 Then
MsgBox "Member not Found"
Text1 = ""
Text1.SetFocus
Exit Sub
End If
If rs(8) <> "P" Then
MsgBox "This Member have already a book or meber is expired"
Text1 = ""
Text1.SetFocus
Exit Sub
End If
lblName = rs(1)
lblAddress = rs(2)
lblMemNo = rs(0)
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
Private Sub Text2_LostFocus()
If Trim(Text2) <> "" Then
strq = "select * from bookmaster where bookno=" & Text2 & ""
If rs.State = adStateOpen Then rs.Close
Grid.TextMatrix(i, 1) = rs(1)
Grid.TextMatrix(i, 2) = rs(2)
Grid.TextMatrix(i, 3) = rs(3)
Grid.TextMatrix(i, 4) = rs(4)
rs.MoveNext
Next
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub CmdClo_Click()
Unload Me
End Sub
Private Sub Form_Activate()
populateGrid
End Sub
Private Sub Form_Load()
Me.Top = 1545
Me.Left = 2640
End Sub
Grid.TextMatrix(i, 7) = rs(7)
Grid.TextMatrix(i, 8) = rs(8)
rs.MoveNext
Next
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Me.Top = 0
Me.Left = 0
populateGrid
End Sub
Else
lblBookNo = Trim(Str(rs(0) + 1))
End If
End Function
Private Sub AuCombo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
Private Sub CatCombo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
Private Sub Command1_Click()
strq = "insert into bookmaster values('" & Create_ID & "','" & _
CatCombo & "','" & txtBookName & "','" & lblBookNo & "','" & AuCombo
& "','" & txtPrice & "','" & txtPage & "','" & Date & "','" & "P" & "')"
conn.Execute strq
Form_Activate
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
clear_TextBox
Bookno
popCombo
populateGrid
End Sub
Private Sub clear_TextBox()
Dim ctl As Control
For Each ctl In Controls
End Sub
Private Sub txtBookName_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
Private Sub txtPage_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
Private Sub txtPrice_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
strq = "Update MemberMaster set status='P' where memno=" & Text2 & ""
conn.Execute strq
Form_Activate
End Sub
Private Sub clear_TextBox()
Dim ctl As Control
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
clear_TextBox
End Sub
Private Sub Form_Load()
Me.Top = 1545
Me.Left = 2640
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub