Connecting Tech Pros Worldwide Help | Site Map

EOF and BOF Error

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2006, 04:25 PM
Kaur
Guest
 
Posts: n/a
Default EOF and BOF Error

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_Obj ective_Description.Caption
= " "

Forms!frm_DE_Objective_Progress_Assessment.lbl_Pub lished_Year.Caption =
" "
'''' 'Forms!frm_DE_Objective_Progress_Assessment.ObjD_I D.Value
= ""


Forms!frm_DE_Objective_Progress_Assessment.lbl_Obj ective_Description.Caption
= strObjectiveDescription

Forms!frm_DE_Objective_Progress_Assessment.lbl_Pub lished_Year.Caption =
strPublishedYear
Forms!frm_DE_Objective_Progress_Assessment.ObjD_ID .Value =
lngObjD_ID

' ' ' Fill form
Forms!frm_DE_Objective_Progress_Assessment.Fill_Fo rm 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.


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.