Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

EOF or BOF error

Discussion in 'Information Technology' started by Kaur, Jul 28, 2006.

Tags:
  1. Kaur

    Kaur
    Expand Collapse
    Guest

    Hi,

    I need help on a code that each time I add a new record it gives me an
    error "Eithe EOF or BOF is true, or the current record has been
    deleted. Requested operation requires a current record.

    I have an unboud form that records all the objectives. User can put
    more than one progress assessment code and comment for each objective.
    I have a control on Objective form that opens up Progress assessment
    form. The code behind this control is as follows:

    On Error GoTo Err_Handler

    Dim lngObjD_ID As Long
    Dim strPublishedYear As String
    Dim strObjectiveDescription As String

    lngObjD_ID = Me.ObjD_ID.Value
    strPublishedYear = Forms!frm_MainMenuViewer.cbo_FY.Value
    strObjectiveDescription = Me.Objective_Description.Value

    DoCmd.OpenForm "frm_DE_Objective_Progress_Assessment", acNormal
    Forms!frm_DE_Objective_Progress_Assessment.Caption = "Objective
    Progress Assessment"

    Forms!frm_DE_Objective_Progress_Assessment.lbl_Objective_Description.Caption
    = " "

    Forms!frm_DE_Objective_Progress_Assessment.lbl_Published_Year.Caption =
    " "
    '''' 'Forms!frm_DE_Objective_Progress_Assessment.ObjD_ID.Value
    = ""


    Forms!frm_DE_Objective_Progress_Assessment.lbl_Objective_Description.Caption
    = strObjectiveDescription

    Forms!frm_DE_Objective_Progress_Assessment.lbl_Published_Year.Caption =
    strPublishedYear
    Forms!frm_DE_Objective_Progress_Assessment.ObjD_ID.Value =
    lngObjD_ID

    ' ' ' Fill form
    Forms!frm_DE_Objective_Progress_Assessment.Fill_Form lngObjD_ID

    Forms!frm_DE_Objective_Progress_Assessment.Modal = True



    Exit_Sub:
    Exit Sub

    Err_Handler:
    Debug.Print Err.Description
    Resume Exit_Sub

    End Sub


    Any time I add a new objective and add progress assessment I get the
    above mentioned error. For all the existing objectives if I add a
    progress assessment, the records save without any problem.

    The code behind the progress Assessment form is as follows:
    Public Sub Fill_Form(ByVal vlngObjD_ID As Long)
    On Error GoTo Err_Handler

    OpenConnection_To_BE

    'Dim rst As ADODB.Recordset
    Dim fld As ADODB.Field
    Dim strListItems As String

    Dim strSQL As String

    Dim sControlName As String

    Set rst = GetElementsStatus(vlngObjD_ID)

    With rst
    Do While Not (rst.EOF)
    Me(rst!Element & "_cbo_Element_Color_Code").Value =
    rst!Element_Color_Code
    Me(rst!Element & "_RSA_ID").Value = rst!RSA_ID
    Me(rst!Element & "_Analysis").Value = rst!Analysis

    If Not (IsNull(rst!Analysis)) Then
    Me(rst!Element & "_Analysis").ControlTipText =
    Left(rst!Analysis, 250) & " ..."
    Else
    Me(rst!Element & "_Analysis").ControlTipText = ""
    End If


    rst.MoveNext
    Loop
    End With


    Exit_Sub:
    Exit Sub

    Err_Handler:
    MsgBox Err.Description
    Resume Exit_Sub


    End Sub




    Private Sub cmd_Close_Form_Click()
    On Error GoTo Err_cmd_Close_Form_Click

    With rst
    rst.MoveFirst
    Do While Not (rst.EOF)
    rst!Element_Color_Code = Me(rst!Element &
    "_cbo_Element_Color_Code").Value
    'rst!RSA_ID = Me(rst!Element & "_RSA_ID").Value
    rst!Analysis = Me(rst!Element & "_Analysis").Value
    rst.MoveNext
    Loop
    End With
    If MsgBox("Save all changes?", vbYesNo) = vbYes Then
    rst.UpdateBatch
    Else
    rst.CancelBatch
    End If
    ' End If

    DoCmd.Close

    Exit_cmd_Close_Form_Click:
    Exit Sub

    Err_cmd_Close_Form_Click:
    MsgBox Err.Description
    Resume Exit_cmd_Close_Form_Click


    End Sub

    I am failing to understand why on entering a new objective and then
    entering the progress assessment for this new objective gives me an
    error.

    Any help would be appreciated.
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page