Results 1 to 3 of 3

Thread: Updating DB with bound controls

  1. #1

    Thread Starter
    PowerPoster JPnyc's Avatar
    Join Date
    Oct 2002
    Location
    Manhattan
    Posts
    3,015

    Updating DB with bound controls

    This is a perplexing one. The bound form will only let me update the 1st recordset in a table. The others give this error mess.
    Insufficient key column for updating or refreshing

  2. #2

    Thread Starter
    PowerPoster JPnyc's Avatar
    Join Date
    Oct 2002
    Location
    Manhattan
    Posts
    3,015
    I think it's only allowing the 1st record to update because I haven't told the DB to move the rs.

    VB Code:
    1. Private Sub cmdOK_click()
    2. Dim choice As Integer
    3. Dim rscomOES As Recordset
    4. Dim strISBN As String
    5.     choice = MsgBox("This will Alter the Record." & _
    6.     " Do you wish to proceed?", vbYesNo)
    7.   If choice = vbYes Then
    8.      strISBN = txtISBN.Text
    9.      deOES.rscomOES.Find "ISBN FROM Products", 1, adSearchForward
    10.   If strISBN = "ISBN" Then
    11.      deOES.rscomOES.Update
    12.      frmProdDet.Hide
    13. Call frmWIMS.NewProd
    14.   Else
    15.      deOES.rscomOES.MoveNext
    16.  End If
    17. End If
    18. End Sub

    Can anyone give me a clue?

  3. #3

    Thread Starter
    PowerPoster JPnyc's Avatar
    Join Date
    Oct 2002
    Location
    Manhattan
    Posts
    3,015
    Ok, even though I'm talking to myself here, I'll have another go. I figured out that the recordset wasn't changing, and that's why I could only update the 1st record. I think I'm getting close with the code, but somethings is wrong with the search, or the SQL statement. Can anyone help me find it?Private Sub cmdOK_click()
    VB Code:
    1. Dim choice As Integer
    2. Dim rscomOES As Recordset
    3. Dim strISBN As String
    4.     choice = MsgBox("This will Alter the Record." & _
    5.     " Do you wish to proceed?", vbYesNo)
    6.   If choice = vbYes Then
    7.      strISBN = txtISBN.Text
    8.      deOES.rscomOES.Find "ISBN Like '" & _
    9.      strISBN & "'", 0, adSearchForward, adBookmarkFirst
    10.   If strISBN = "ISBN" Then
    11.      deOES.rscomOES.Update
    12.      frmProdDet.Hide
    13.      
    14. Call frmWIMS.NewProd
    15.  
    16.  End If
    17. End If
    18. End Sub

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