Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011

    Unanswered: ADODB.Field error '800a0bcd'

    error message:

    ADODB.Field error '800a0bcd'
    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    /intranet/member/TimeSheet-All/view_timesheet_client_P&L_summary2.asp, line 92

    I has add and delete some data in my database( ms access).
    there are some records that the code will output.
    I has check through the database. there are records there.
    I got a feeling is due to the add/delete of database.

    Thanks in advance.
    God Bless

    line 92 in bold.
    below is my code:

    StaffName = Request.Cookies("StaffNames")
    StaffID = Request.Cookies("StaffIDs")

    Dim pwcoConnection
    Dim strSQL1, strSQL2, strSQL3
    Dim pwcoRecordset
    JobNo = Request("JobID")

    Set pwcoConnection = Server.CreateObject("ADODB.Connection")
    pwcoConnection.ConnectionString = "Provider=Microsoft.jet.oledb.4.0; Data Source=F:\Intranet\database\TimeSheet-Audit.mdb;"

    Set pwcoConnection1 = Server.CreateObject("ADODB.Connection")
    pwcoConnection1.ConnectionString = "Provider=Microsoft.jet.oledb.4.0; Data Source=F:\Intranet\database\AuditJob.mdb;"

    strSQL1 = "SELECT company_name, job_No FROM JobPlan WHERE job_No LIKE '9%' GROUP BY company_name, job_No"
    Set pwcoRecordset1 = pwcoConnection1.Execute(strSQL1)

    While Not pwcoRecordset1.EOF
    JobNo = pwcoRecordset1("job_No")
    strSQL2 = "SELECT company_ID, company_name, job_period, job_No FROM JobPlan WHERE (action_code = '0' OR action_code = '1') AND job_No = '"+JobNo+"'"
    Set pwcoRecordset2 = pwcoConnection1.Execute(strSQL2)

    IF Not pwcoRecordset2.EOF THEN
    ClientID = pwcoRecordset2("company_ID")
    ClientName = pwcoRecordset2("company_name")
    JobPeriod5 = pwcoRecordset2("job_period")

    strSQL3 = "SELECT * FROM jobschedule WHERE job_No = '"+ JobNo +"'"
    Set pwcoRecordset3 = pwcoConnection.Execute(strSQL3)

    strSQL4 = "SELECT * FROM JobFees WHERE job_No = '"+ JobNo +"'"
    Set pwcoRecordset4 = pwcoConnection1.Execute(strSQL4)

    strSQL7 = "SELECT * FROM JobInCharge WHERE company_ID = '"+ ClientID +"'"
    Set pwcoRecordset7 = pwcoConnection1.Execute(strSQL7)
    IF pwcoRecordset7.EOF THEN
    ManagerName = "N.A"
    ManagerName = pwcoRecordset7("manager_name")
    END IF

    Dim AuditFees, TaxFees, AcctFees, SecFees, SpecialFees
    IF pwcoRecordset4.EOF THEN
    AuditFees = 0
    AuditFees = pwcoRecordset4("audit_fees")
    END IF

    Dim OverallHourCharges
    TotalJobHourschr = 0
    TotalJobHoursNonchr = 0
    TotalHourCharges = 0
    OverallHourCharge = 0

    WHILE NOT pwcoRecordset3.EOF
    TimeSheetNo = pwcoRecordset3("timesheet_No")
    JobHoursChr = pwcoRecordset3("job_hours_chr")
    JobHoursNonchr = pwcoRecordset3("job_hours_nonchr")
    IF JobHoursChr = "" THEN
    JobHoursChr = 0
    END IF
    IF JobHoursNonchr = "" THEN
    JobHoursNonchr = 0
    END IF
    TotalJobHourschr = TotalJobHourschr + JobHoursChr
    TotalJobHoursNonchr = TotalJobHoursNonchr + JobHoursNonchr

    strSQL5 = "SELECT * FROM timetable WHERE timesheet_No = '"+TimeSheetNo+"'"
    Set pwcoRecordset5 = pwcoConnection.Execute(strSQL5)

    T_StaffName = pwcoRecordset5("staff_name")

    Department = pwcoRecordset5("department")
    T_Position = pwcoRecordset5("t_position")

  2. #2
    Join Date
    Nov 2003
    Christchurch, New Zealand
    You code makes an assumption that you will always get records when you execute
    strSQL5 = "SELECT * FROM timetable WHERE timesheet_No = '"+TimeSheetNo+"'"
    This may be valid from a business point of view but it apparently is not from a data point of view.

    To protect yourself from this you can try the following

    Set pwcoRecordset5 = pwcoConnection.Execute(strSQL5)
    strSQL5 = "SELECT * FROM timetable WHERE timesheet_No = '"+TimeSheetNo+"'"
    if(not(pwcoRecordset5.EOF)) then
        ' process the record
        T_StaffName = pwcoRecordset5("staff_name")
        Department = pwcoRecordset5("department")
        T_Position = pwcoRecordset5("t_position") 
        Response.Write("The following query returned zero rows")
    end if
    of course this assumes that if you have multiple rows returned you only want to process the first one and that you want to see when you have a problem in your data.

    Anyway, the above should be able to give you enough information to find the root cause of your problem.

  3. #3
    Join Date
    Jul 2011

    Thank you

    Thank you.I has managed to solved the problem. inside MS access, there are a few tables in the I only keep looking for a record in a table. then I realise that programing/source is looking for another table in the same database.
    thank you very much.

Posting Permissions

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