Hi! I have this two table namely Books and BorrowedBooks. The books table has field named as "Available" which has Yes/No data type. What i want to achieve is that when I issue a certain book, I would like the the "Available" field which is by default is checked [the check box] would be unchecked. Right now i have this code: I dunno know if what im doing actually is correct.
VB Code:
Private Sub cmdIssueBook1_Click() Dim sSQL1 As String Dim sSQL2 As String sSQL1 = "INSERT INTO BorrowedBooks (IDNO,Title,AccNum,DateBorrowed,DateDue) VALUES" & _ "('" & lblStudIDDisp.Caption & "','" & lblBook1Title.Caption & _ "','" & lblAccNum1.Caption & "','" & lblDateBorrowedDisp.Caption & _ "','" & lblDateDueDisp.Caption & "')" MyConn.Execute sSQL1, , adCmdText + adExecuteNoRecords MyConn.Execute sSQL1, "UPDATE books SET Available = TRUE" If MyRs6.State = 1 Then MyRs6.Close sSQL2 = "SELECT LName,FName,MI from borrowers where LName= '" & lblStudLNameDisp.Caption & "'AND FName='" & lblStudFName.Caption & "' and MI='" & lblStudMIDisp.Caption & "'" MyRs6.Open sSQL2, MyConn, adOpenKeyset, adLockOptimistic MsgBox "Book has been recorded to the account of " & lblStudFNameDisp.Caption & " " & lblStudMIDisp.Caption & " " & lblStudLNameDisp.Caption & "." End Sub
my first time to use .execute




Reply With Quote