PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
.eof or .bof is closed problem again-VBForums
Results 1 to 4 of 4

Thread: .eof or .bof is closed problem again

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    .eof or .bof is closed problem again

    can anyone help me with this...im trying to delete the record but the error is .eof or .bof is clsed or have been deleted. what will i do...



    VB Code:
    1. Private Sub cmdDelete_Click()
    2. On Error GoTo Err:
    3. With tbAcademicYear
    4.     '---------------------------------
    5.     'Check if there is no record
    6.     '---------------------------------
    7.    If .RecordCount < 1 Then MsgBox "No school year in the list.Please check it!", vbExclamation, "CSRS version 1": Exit Sub
    8.     '---------------------------------
    9.     'Confirm deletion of record
    10.     '---------------------------------
    11.     Dim ans As Integer
    12.     Dim pos As Integer
    13.     ans = MsgBox("Are you sure you want to delete the selected record?", vbCritical + vbYesNo, "Confirm Record Delete")
    14.     If ans = vbYes Then
    15.         '-----------------------------
    16.         'Delete the record
    17.         '-----------------------------
    18.         pos = Val(LV1.SelectedItem)
    19.              If .EOF = False Then
    20.                 .Delete adAffectCurrent
    21.                 .Requery
    22.             Else
    23.                 MsgBox "huh"
    24.              End If
    25.  
    26.         If .RecordCount > 0 Then
    27.             .AbsolutePosition = pos
    28.             If .EOF Then .MoveFirst
    29.             '---------------------------------
    30.             'Fill listview
    31.             '---------------------------------
    32.             pos = .AbsolutePosition
    33.             load_rec
    34.             LV1.ListItems.Item(pos).EnsureVisible
    35.             LV1.ListItems.Item(pos).Selected = True
    36.             .AbsolutePosition = LV1.SelectedItem
    37.             '---------------------------------
    38.             'End-fill listview
    39.             '---------------------------------
    40.         'Else
    41.            ' LV1.ListItems.Clear
    42.         End If
    43.                 MsgBox "Record has been successfully deleted.", vbInformation, "Confirm"
    44.     End If
    45.     ans = 0
    46.     pos = 0
    47.     Me.MousePointer = vbDefault
    48. End With
    49. Exit Sub
    50. Err:
    51.     MsgBox Err.Description, vbCritical, "Academic Year"
    52.  
    53. End Sub
    54.  
    55.  
    56. Private Sub Form_Load()
    57. tbAcademicYear.CursorLocation = adUseClient
    58. tbAcademicYear.Open "Select * from tbacademicyear", cn, adOpenDynamic, adLockOptimistic
    59.  
    60. CallFields
    61. End Sub

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: .eof or .bof is closed problem again

    try using adOpenStatic .... and/or adUseServer

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: .eof or .bof is closed problem again

    Are you sure the record you are trying to delete exists?

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,849

    Re: .eof or .bof is closed problem again

    does recordcount return valid count when you are using a dynamic cursor? or just -1
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width