Results 1 to 37 of 37

Thread: current record set does not support upadating

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Unhappy current record set does not support upadating

    can anyone help me with this i'v been trying to fix this but i can't. ive already done the solutions posted in forums but still having error...
    the error is the .fields(0) = txtappid down... please help me... thank you in advance.

    VB Code:
    1. Private Sub Form_Load()
    2. tbInquiry.Open "Select * from tbinquiry", cn, adOpenKeyset, adLockOptimistic
    3. CallFields
    4. End Sub
    5. Private Sub LV1_Click()
    6. str = "Select * from tbinquiry where ApplicantID like '" & LV1.SelectedItem.Text & "'"
    7. Set tbInquiry = cn.Execute(str)
    8.  
    9. With tbInquiry
    10.     If .BOF = False And .EOF = False Then
    11.         txtFind = .Fields(3) & " " & .Fields(1) & ", " & .Fields(2)
    12.        
    13.     End If
    14. End With
    15. End Sub
    16.  
    17. Private Sub cmdSave_Click()
    18. Frame5.Visible = True
    19. Frame4.Visible = False
    20. txtSummary.Text = "(New Entry Saved. CLick Next To Proceed."
    21.  
    22. With tbInquiry
    23.             .Fields(0) = txtAppID
    24.     .Fields(1) = txtAppInfo(0)
    25.     .Fields(2) = txtAppInfo(1)
    26.     .Fields(3) = txtAppInfo(2)
    27.     .Fields(4) = txtAppInfo(3)
    28.     .Fields(5) = txtAppInfo(4)
    29.     .Fields(6) = cmbTFA.Text
    30.     '.Fields(7) =
    31.         'AddFields
    32.         .Update
    33.          MsgBox "Edit successfully saved to the record.", vbInformation
    34. End With
    35. End Sub
    36.  
    37. Private Sub Form_Load()
    38. str = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "
    39. Set tbInquiry = cn.Execute(str)
    40.  
    41. With tbInquiry
    42.     If .BOF = False And .EOF = False Then
    43.         txtAppID = .Fields(0)
    44.         txtAppInfo(0) = .Fields(1)
    45.         txtAppInfo(1) = .Fields(2)
    46.         txtAppInfo(2) = .Fields(3)
    47.         txtAppInfo(3) = .Fields(4)
    48.         txtAppInfo(4) = .Fields(5)
    49.         cmbTFA.Text = .Fields(6)
    50.        
    51.     End If
    52. End With
    Last edited by si_the_geek; Feb 6th, 2007 at 11:39 AM. Reason: added vbcode tags

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    This will solve your problem
    VB Code:
    1. tbInquiry.Open "Select * from tbinquiry", cn, [B]adOpenDynamic[/B], adLockOptimistic
    Please mark you thread resolved using the Thread Tools as shown

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: current record set does not support upadating

    Don't use = cn.Execute(str) to open a recordset, the correct method is to use the .Open method as at the top of your code... the error will then magically disappear.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    ive already change that to adOpenDynamic but still have the same error.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: current record set does not support upadating

    The problem is that lines like this:
    VB Code:
    1. Set tbInquiry = cn.Execute(str)
    ..need to be replaced with this:
    VB Code:
    1. tbInquiry.Open str, cn, adOpenKeyset, adLockOptimistic

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    it says that the connection is already open

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    if i remove the connection to the form load and replace the tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic im having a error of command text was not set for the command object

  8. #8
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    I think you have post the Full Code
    Please mark you thread resolved using the Thread Tools as shown

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    in form 1 this is my code
    VB Code:
    1. Dim ls As ListItem
    2. Dim inq As String ' for inquiry
    3.  
    4.  
    5. Private Sub CallFields()
    6. With tbInquiry
    7.     LV1.ListItems.Clear
    8.     While .EOF = False
    9.         Set ls = LV1.ListItems.Add(, , .Fields(0))
    10.         ls.SubItems(1) = .Fields(3) & " " & .Fields(1) & "," & .Fields(2)
    11.         .MoveNext
    12.     Wend
    13. End With
    14. End Sub
    15.  
    16. Private Sub cmdCancel_Click()
    17. ans = MsgBox("Are you sure you want to cancel this?", vbYesNo + vbQuestion, " Titus School of Multimedia")
    18.     If ans = vbYes Then
    19.       Unload Me
    20.     End If
    21. End Sub
    22.  
    23. Private Sub cmdSelect_Click()
    24. 'If LV1.SelectedItem = False Then
    25.   ' MsgBox "Select first before you can move to another.", vbInformation, "Titus School of Multimedia"
    26. 'Else
    27. Unload Me
    28. frmEditApplicant.Show
    29. 'End If
    30.  
    31. End Sub
    32.  
    33. Private Sub Form_Load()
    34. 'tbInquiry.Open "Select * from tbinquiry", cn, adOpenDynamic, adLockOptimistic
    35. CallFields
    36. End Sub
    37. Private Sub LV1_Click()
    38.  
    39. inq = "Select * from tbinquiry where ApplicantID like '" & LV1.SelectedItem.Text & "'"
    40. tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic
    41.  
    42. With tbInquiry
    43.     If .BOF = False And .EOF = False Then
    44.         txtFind = .Fields(3) & " " & .Fields(1) & ", " & .Fields(2)
    45.        
    46.     End If
    47. End With
    48. End Sub
    49.  
    50. 'Private Sub Form_Activate()
    51. 'CallFields
    52. 'End Sub
    53. Private Sub txtFind_Change()
    54. inq = "Select * from tbinquiry Where LastName like '" & txtFind & "%'"
    55. Set tbInquiry = cn.Execute(inq)
    56.  
    57. If tbInquiry.BOF = True And tbInquiry.EOF = True Then
    58.     txtFind = Left(txtFind, Len(txtFind) - 0)
    59.     txtFind.SelStart = Len(txtFind)
    60. Else
    61.     CallFields
    62. End If
    63. End Sub

    and in form 2


    VB Code:
    1. Option Explicit
    2. Public State                As FormState 'Variable used to determine on how the form used
    3.  
    4. Dim inq As String
    5.  
    6. Private Sub cmdCancel_Click()
    7. ans = MsgBox("Are you sure you want to cancel this?", vbYesNo + vbQuestion, " Titus School of Multimedia")
    8.     If ans = vbYes Then
    9.       Unload Me
    10.     End If
    11. End Sub
    12.  
    13. Private Sub cmdnext_Click()
    14. If CheckTextBox(txtAppID, "You cannot move to this part unless you have created New Applicant ID.") = False Then
    15.     StartTxt txtAppID
    16. ElseIf CheckTextBox(txtAppInfo(0), "Invalid 'FIRST NAME' value. This field is required, please enter a value.") = False Then
    17.     StartTxt txtAppInfo(0)
    18. ElseIf CheckTextBox(txtAppInfo(1), "Invalid 'Middle Name' value. This field is required, please enter a value.") = False Then
    19.     StartTxt txtAppInfo(1)
    20. ElseIf CheckTextBox(txtAppInfo(2), "Invalid 'LAST NAME' value. This field is required, please enter a value.") = False Then
    21.     StartTxt txtAppInfo(2)
    22. ElseIf CheckTextBox(txtAppInfo(3), "Invalid 'ADDRESS' value. This field is required, please enter a value.") = False Then
    23.     StartTxt txtAppInfo(3)
    24. ElseIf CheckTextBox(txtAppInfo(4), "Invalid 'CONTACT NO' value. This field is required, please enter a value.") = False Then
    25.     StartTxt txtAppInfo(4)
    26. Else
    27.     Frame1.Visible = False
    28.     Frame4.Visible = True
    29.    
    30.     'tbInquiry.MoveFirst
    31.     'tbInquiry.Find "ApplicantID = '" & txtAppID & "'"
    32.     'show summary
    33.        txtSummary.Text = "Applicant ID: " & txtAppID
    34.        txtSummary.Text = txtSummary.Text & vbNewLine & "First Name: " & txtAppInfo(0)
    35.        txtSummary.Text = txtSummary.Text & vbNewLine & "Middle Name: " & txtAppInfo(1)
    36.        txtSummary.Text = txtSummary.Text & vbNewLine & "Last Name: " & txtAppInfo(2)
    37.        txtSummary.Text = txtSummary.Text & vbNewLine & "Home Address: " & txtAppInfo(3)
    38.        txtSummary.Text = txtSummary.Text & vbNewLine & "Contact Number: " & txtAppInfo(4)
    39.        txtSummary.Text = txtSummary.Text & vbNewLine & "Tuition Fee Assistance: " & cmbTFA.Text
    40.        txtSummary.Text = txtSummary.Text & vbNewLine & "Creation Date: " & FormatDateTime(Now, vbGeneralDate)
    41. End If
    42. End Sub
    43.  
    44. Private Sub cmdSave_Click()
    45. Frame5.Visible = True
    46. Frame4.Visible = False
    47. txtSummary.Text = "(New Entry Saved. CLick Next To Proceed."
    48.  
    49. With tbInquiry
    50.             .Fields(0) = txtAppID
    51.     .Fields(1) = txtAppInfo(0)
    52.     .Fields(2) = txtAppInfo(1)
    53.     .Fields(3) = txtAppInfo(2)
    54.     .Fields(4) = txtAppInfo(3)
    55.     .Fields(5) = txtAppInfo(4)
    56.     .Fields(6) = cmbTFA.Text
    57.     '.Fields(7) =
    58.         'AddFields
    59.         .Update
    60.          MsgBox "Edit successfully saved to the record.", vbInformation
    61. End With
    62. End Sub
    63.  
    64. Private Sub Form_Load()
    65. inq = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "
    66. tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic
    67.  
    68. With tbInquiry
    69.     If .BOF = False And .EOF = False Then
    70.         txtAppID = .Fields(0)
    71.         txtAppInfo(0) = .Fields(1)
    72.         txtAppInfo(1) = .Fields(2)
    73.         txtAppInfo(2) = .Fields(3)
    74.         txtAppInfo(3) = .Fields(4)
    75.         txtAppInfo(4) = .Fields(5)
    76.         cmbTFA.Text = .Fields(6)
    77.        
    78.     End If
    79. End With
    80.  
    81. 'txtAppInfo(0).SetFocus
    82. Frame4.Visible = False
    83. Frame5.Visible = False
    84. txtAppID.Enabled = False
    85. cmdprevious.Enabled = False
    86. End Sub
    Last edited by si_the_geek; Feb 6th, 2007 at 12:09 PM. Reason: added vbcode tags

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    yes im done that but still having an error.. sorry im just a beginner

  11. #11
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: current record set does not support upadating

    When you post code please put it inside VBCode tags so it is displayed in a more readable way - either using the button in the post editor screen (or at the top of the Quick Reply box), or by putting them in manually, like this: [vbcode] 'code here [/vbcode]

    (I have edited your posts above)

    The problem seems to be that you have commented out the line in Form1's Form_Load that actually loads the data - which then makes CallFields fail (as the recordset is not set to anything).

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    [Highlight=VB]Option Explicit
    Public State As FormState 'Variable used to determine on how the form used

    Dim inq As String

    Private Sub cmdCancel_Click()
    ans = MsgBox("Are you sure you want to cancel this?", vbYesNo + vbQuestion, " Titus School of Multimedia")
    If ans = vbYes Then
    Unload Me
    End If
    End Sub

    Private Sub cmdnext_Click()
    If CheckTextBox(txtAppID, "You cannot move to this part unless you have created New Applicant ID.") = False Then
    StartTxt txtAppID
    ElseIf CheckTextBox(txtAppInfo(0), "Invalid 'FIRST NAME' value. This field is required, please enter a value.") = False Then
    StartTxt txtAppInfo(0)
    ElseIf CheckTextBox(txtAppInfo(1), "Invalid 'Middle Name' value. This field is required, please enter a value.") = False Then
    StartTxt txtAppInfo(1)
    ElseIf CheckTextBox(txtAppInfo(2), "Invalid 'LAST NAME' value. This field is required, please enter a value.") = False Then
    StartTxt txtAppInfo(2)
    ElseIf CheckTextBox(txtAppInfo(3), "Invalid 'ADDRESS' value. This field is required, please enter a value.") = False Then
    StartTxt txtAppInfo(3)
    ElseIf CheckTextBox(txtAppInfo(4), "Invalid 'CONTACT NO' value. This field is required, please enter a value.") = False Then
    StartTxt txtAppInfo(4)
    Else
    Frame1.Visible = False
    Frame4.Visible = True

    'tbInquiry.MoveFirst
    'tbInquiry.Find "ApplicantID = '" & txtAppID & "'"
    'show summary
    txtSummary.Text = "Applicant ID: " & txtAppID
    txtSummary.Text = txtSummary.Text & vbNewLine & "First Name: " & txtAppInfo(0)
    txtSummary.Text = txtSummary.Text & vbNewLine & "Middle Name: " & txtAppInfo(1)
    txtSummary.Text = txtSummary.Text & vbNewLine & "Last Name: " & txtAppInfo(2)
    txtSummary.Text = txtSummary.Text & vbNewLine & "Home Address: " & txtAppInfo(3)
    txtSummary.Text = txtSummary.Text & vbNewLine & "Contact Number: " & txtAppInfo(4)
    txtSummary.Text = txtSummary.Text & vbNewLine & "Tuition Fee Assistance: " & cmbTFA.Text
    txtSummary.Text = txtSummary.Text & vbNewLine & "Creation Date: " & FormatDateTime(Now, vbGeneralDate)
    End If
    End Sub

    Private Sub cmdSave_Click()
    Frame5.Visible = True
    Frame4.Visible = False
    txtSummary.Text = "(New Entry Saved. CLick Next To Proceed."

    With tbInquiry
    .Fields(0) = txtAppID
    .Fields(1) = txtAppInfo(0)
    .Fields(2) = txtAppInfo(1)
    .Fields(3) = txtAppInfo(2)
    .Fields(4) = txtAppInfo(3)
    .Fields(5) = txtAppInfo(4)
    .Fields(6) = cmbTFA.Text
    '.Fields(7) =
    'AddFields
    .Update
    MsgBox "Edit successfully saved to the record.", vbInformation
    End With
    End Sub

    Private Sub Form_Load()
    inq = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "
    tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic

    With tbInquiry
    If .BOF = False And .EOF = False Then
    txtAppID = .Fields(0)
    txtAppInfo(0) = .Fields(1)
    txtAppInfo(1) = .Fields(2)
    txtAppInfo(2) = .Fields(3)
    txtAppInfo(3) = .Fields(4)
    txtAppInfo(4) = .Fields(5)
    cmbTFA.Text = .Fields(6)

    End If
    End With

    'txtAppInfo(0).SetFocus
    Frame4.Visible = False
    Frame5.Visible = False
    txtAppID.Enabled = False
    cmdprevious.Enabled = False
    End Sub

  13. #13
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    Put this before the opening of the all tbInquiry
    VB Code:
    1. set tbInquiry=Nothing
    Please mark you thread resolved using the Thread Tools as shown

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    if i commented it out it will have an error point to the tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic of lV1_Click saying that Operation is not allowed when the object is open.

  15. #15
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: current record set does not support upadating

    That is terrible advice I'm afraid - you should never set an object variable to Nothing before it has been closed properly. It can cause memory issues, and can cause damage - in this case database locking and/or corruption.

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    where i will put this
    [Highlight=VB]
    set tbInquiry=Nothing

  17. #17
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: current record set does not support upadating

    Ah yes, in that case add these two lines before that .Open line:
    VB Code:
    1. tbInquiry.Close
    2. Set tbInquiry=Nothing

    ps: you aren't using the tags correctly.
    [vbcode] 'code here [/vbcode]

  18. #18
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    VB Code:
    1. Option Explicit
    2. Public State As FormState 'Variable used to determine on how the form used
    3.  
    4. Dim inq As String
    5.  
    6. Private Sub cmdCancel_Click()
    7. ans = MsgBox("Are you sure you want to cancel this?", vbYesNo + vbQuestion, " Titus School of Multimedia")
    8. If ans = vbYes Then
    9. Unload Me
    10. End If
    11. End Sub
    12.  
    13. Private Sub cmdnext_Click()
    14. If CheckTextBox(txtAppID, "You cannot move to this part unless you have created New Applicant ID.") = False Then
    15. StartTxt txtAppID
    16. ElseIf CheckTextBox(txtAppInfo(0), "Invalid 'FIRST NAME' value. This field is required, please enter a value.") = False Then
    17. StartTxt txtAppInfo(0)
    18. ElseIf CheckTextBox(txtAppInfo(1), "Invalid 'Middle Name' value. This field is required, please enter a value.") = False Then
    19. StartTxt txtAppInfo(1)
    20. ElseIf CheckTextBox(txtAppInfo(2), "Invalid 'LAST NAME' value. This field is required, please enter a value.") = False Then
    21. StartTxt txtAppInfo(2)
    22. ElseIf CheckTextBox(txtAppInfo(3), "Invalid 'ADDRESS' value. This field is required, please enter a value.") = False Then
    23. StartTxt txtAppInfo(3)
    24. ElseIf CheckTextBox(txtAppInfo(4), "Invalid 'CONTACT NO' value. This field is required, please enter a value.") = False Then
    25. StartTxt txtAppInfo(4)
    26. Else
    27. Frame1.Visible = False
    28. Frame4.Visible = True
    29.  
    30. 'tbInquiry.MoveFirst
    31. 'tbInquiry.Find "ApplicantID = '" & txtAppID & "'"
    32. 'show summary
    33. txtSummary.Text = "Applicant ID: " & txtAppID
    34. txtSummary.Text = txtSummary.Text & vbNewLine & "First Name: " & txtAppInfo(0)
    35. txtSummary.Text = txtSummary.Text & vbNewLine & "Middle Name: " & txtAppInfo(1)
    36. txtSummary.Text = txtSummary.Text & vbNewLine & "Last Name: " & txtAppInfo(2)
    37. txtSummary.Text = txtSummary.Text & vbNewLine & "Home Address: " & txtAppInfo(3)
    38. txtSummary.Text = txtSummary.Text & vbNewLine & "Contact Number: " & txtAppInfo(4)
    39. txtSummary.Text = txtSummary.Text & vbNewLine & "Tuition Fee Assistance: " & cmbTFA.Text
    40. txtSummary.Text = txtSummary.Text & vbNewLine & "Creation Date: " & FormatDateTime(Now, vbGeneralDate)
    41. End If
    42. End Sub
    43.  
    44. Private Sub cmdSave_Click()
    45. Frame5.Visible = True
    46. Frame4.Visible = False
    47. txtSummary.Text = "(New Entry Saved. CLick Next To Proceed."
    48.  
    49. With tbInquiry
    50. .Fields(0) = txtAppID
    51. .Fields(1) = txtAppInfo(0)
    52. .Fields(2) = txtAppInfo(1)
    53. .Fields(3) = txtAppInfo(2)
    54. .Fields(4) = txtAppInfo(3)
    55. .Fields(5) = txtAppInfo(4)
    56. .Fields(6) = cmbTFA.Text
    57. '.Fields(7) =
    58. 'AddFields
    59. .Update
    60. MsgBox "Edit successfully saved to the record.", vbInformation
    61. End With
    62. End Sub
    63.  
    64. Private Sub Form_Load()
    65. inq = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "
    66. [B]Set tbInquiry = Nothing 'This will close the previously opend Connection[/B]
    67. tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic
    68.  
    69. With tbInquiry
    70. If .BOF = False And .EOF = False Then
    71. txtAppID = .Fields(0)
    72. txtAppInfo(0) = .Fields(1)
    73. txtAppInfo(1) = .Fields(2)
    74. txtAppInfo(2) = .Fields(3)
    75. txtAppInfo(3) = .Fields(4)
    76. txtAppInfo(4) = .Fields(5)
    77. cmbTFA.Text = .Fields(6)
    78.  
    79. End If
    80. End With
    81.  
    82. 'txtAppInfo(0).SetFocus
    83. Frame4.Visible = False
    84. Frame5.Visible = False
    85. txtAppID.Enabled = False
    86. cmdprevious.Enabled = False
    87. End Sub
    Please mark you thread resolved using the Thread Tools as shown

  19. #19

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    in the second form in having on error [CODE]

    Private Sub Form_Load()

    tbInquiry.Close
    Set tbInquiry = Nothing

    inq = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "
    tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic

  20. #20
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    It should be like this
    VB Code:
    1. Private Sub Form_Load()
    2. [B]Set tbInquiry = Nothing[/B]
    3. inq = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "
    4. tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic
    Please mark you thread resolved using the Thread Tools as shown

  21. #21
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: current record set does not support upadating

    What error?

    By the way - you need to put tags before and after the code, eg:
    [vbcode] 'code here [/vbcode]

    Quote Originally Posted by danasegarane
    VB Code:
    1. Private Sub Form_Load()
    2. inq = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "
    3. [B]Set tbInquiry = Nothing 'This will close the previously opend Connection[/B]
    4. tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic
    Please read my post above - your advice is not only bad, but causes errors.

    That line does not do ANYTHING with the connection. It doesn't do anything useful with the recordset either - the recordset still exists, it is just that the variable is no longer linked to it.

  22. #22

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    wow.... thank you so much... thank ou for the patience... its running now... does it same with deleting

  23. #23
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    Dear SI,
    IF the Recordset is not Open and If we tries the
    .Close it will Give Error.Instead we can use this method
    VB Code:
    1. inq = "Select * from tbinquiry where ApplicantID like '" & frmApplicantDetails.lvList.SelectedItem.Text & "' "
    2. If tbInquiry.State = 1 Then tblInquire.Close
    3. tbInquiry.Open inq, cn, adOpenKeyset, adLockOptimistic
    4. Set tbInquiry = Nothing 'This will close the previously opend Connection
    Please mark you thread resolved using the Thread Tools as shown

  24. #24

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    thank you so much guys... you really help me a lot

  25. #25

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    wait im having the problem again when im editing it always the first record is shown even if i click the last record the first record will be show...

  26. #26

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    im having an error when closing it

  27. #27
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    What is the Errorr Msg?
    Please mark you thread resolved using the Thread Tools as shown

  28. #28

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    Operartion are not allowed because the object are closed

  29. #29

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    how can i add an applicant id number with a letter like this one APP-0001
    VB Code:
    1. With tbInquiry
    2.     If .RecordCount = 0 Then
    3.         txtAppID = "00000001"
    4.     Else
    5.         .MoveLast
    6.         txtAppID = .Fields(0) + 1
    7. '        txtAppInfo(0).SetFocus
    8.     End If
    9. End With

  30. #30
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    Which Line you are getting the error?
    Please mark you thread resolved using the Thread Tools as shown

  31. #31
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    VB Code:
    1. txtAppID = rs.fields(0)
    2. tmp = left(tmp,3) & (Format(Cint(right(tmp,4))+1,"00#")
    Please mark you thread resolved using the Thread Tools as shown

  32. #32
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    This one
    VB Code:
    1. If tblinquiry.state=0 then tblInquiry.open(your connection string)
    2.  
    3. With tbInquiry
    4. .Fields(0) = txtAppID
    5. .Fields(1) = txtAppInfo(0)
    6. .Fields(2) = txtAppInfo(1)
    7. .Fields(3) = txtAppInfo(2)
    8. .Fields(4) = txtAppInfo(3)
    9. .Fields(5) = txtAppInfo(4)
    10. .Fields(6) = cmbTFA.Text
    11. '.Fields(7) =
    12. 'AddFields
    13. .Update
    14. MsgBox "Edit successfully saved to the record.", vbInformation
    15. End With
    Please mark you thread resolved using the Thread Tools as shown

  33. #33

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    in my list view i have a checkbox how can i put the one that the user check in the list view to the database


    VB Code:
    1. If LV1.ListItems.Count - 1 > -1 Then
    2.                
    3.                 ItemCount = -1
    4.                 For Each ls In LV1.ListItems
    5.                     If ls.Checked = True Then
    6.                         ItemCount = ItemCount + 1
    7.                     End If
    8.                 Next
    9.                
    10.                 ReDim AccessTitle(ItemCount)
    11.                
    12.                i = 0
    13.                For Each ls In LV1.ListItems
    14.                
    15.                     If ls.Checked = True Then
    16.                    
    17.                         AccessTitle(i) = ls.Text
    18.                         i = i + 1
    19.                     End If
    20.                 Next
    21.     End If
    22.    
    23. End Sub

  34. #34

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    in dois this
    VB Code:
    1. txtAppID = rs.fields(0)
    2. tmp = left(tmp,3) & (Format(Cint(right(tmp,4))+1,"00#")
    the
    VB Code:
    1. tmp = left(tmp,3) & (Format(Cint(right(tmp,4))+1,"00#")
    comes in red color whats he error

  35. #35
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    Where you get the Red Colour
    Please mark you thread resolved using the Thread Tools as shown

  36. #36

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: current record set does not support upadating

    when i just enter it becomes red

  37. #37
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: current record set does not support upadating

    Try this
    VB Code:
    1. tmp = left(tmp,3) & (Format(Cint(right(tmp,4))+1,"00#")[B])[/B]
    Please mark you thread resolved using the Thread Tools as shown

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