Results 1 to 31 of 31

Thread: Connection Object Question [Resolved]

Threaded View

  1. #1

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Connection Object Question [Resolved]

    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:
    1. Private Sub cmdIssueBook1_Click()
    2. Dim sSQL1 As String
    3. Dim sSQL2 As String
    4.  
    5. sSQL1 = "INSERT INTO BorrowedBooks (IDNO,Title,AccNum,DateBorrowed,DateDue) VALUES" & _
    6.     "('" & lblStudIDDisp.Caption & "','" & lblBook1Title.Caption & _
    7.      "','" & lblAccNum1.Caption & "','" & lblDateBorrowedDisp.Caption & _
    8.      "','" & lblDateDueDisp.Caption & "')"
    9.     MyConn.Execute sSQL1, , adCmdText + adExecuteNoRecords
    10.        
    11.     MyConn.Execute sSQL1, "UPDATE books SET Available = TRUE"
    12.        
    13. If MyRs6.State = 1 Then MyRs6.Close
    14. sSQL2 = "SELECT LName,FName,MI from borrowers where LName= '" & lblStudLNameDisp.Caption & "'AND FName='" & lblStudFName.Caption & "' and MI='" & lblStudMIDisp.Caption & "'"
    15. MyRs6.Open sSQL2, MyConn, adOpenKeyset, adLockOptimistic
    16.  
    17. MsgBox "Book has been recorded to the account of " & lblStudFNameDisp.Caption & " " & lblStudMIDisp.Caption & " " & lblStudLNameDisp.Caption & "."
    18. End Sub

    my first time to use .execute
    Last edited by Simply Me; Mar 28th, 2005 at 12:19 AM.
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width