Solved

ASP error '80020009'

Posted on 2009-07-01
5
414 Views
Last Modified: 2012-05-07
Hello,

I have a code that used to work! now for some reason not any more!
all I get after clicking update is

error '80020009'

/academics/timetable_admin/tt_edit_2.asp, line 73

and it dose the update !!!
but it stops and will not continue the rest of the code (showing the table with updated data)

any clue ?
55 '============================================================

56 ' Fix and update the timetable Day based on the Day type

57 sql_str = "SELECT timetable_description.start_date, timetable_description.end_date, timetable_descrip

tion.rotation, timetable_description.start_day FROM timetable_description WHERE timetable_description.id="&tt

_id

58 Set RY = Server.CreateObject("ADODB.Recordset")

59 RY.Open sql_str, objConn, adOpenKeyset, adLockOptimistic

60

61 curDate = CDATE(RY("start_date"))

62 endDAte = CDATE(RY("end_date"))

63 curDay = RY("start_day")

64 rotation = RY("rotation")

65

66 Set RX = Server.CreateObject("ADODB.Recordset")

67 DO While curDate <= endDAte

68

69 sql_str = "SELECT timetable_days.day, timetable_days.type FROM timetable_days WHERE timetable_day

s.date = #"&curDate&"# AND timetable_days.tt_id="&tt_id

70

71 RX.Open sql_str, objConn, adOpenDynamic, adLockOptimistic

72

73 IF RX("type") = 10 THEN

74 RX("day") = curDay

75

76 curDay = CurDay + 1

77 IF curDay > rotation THEN

78 curDay = 1

79 END IF

80

81 ELSE

82 RX("day") = 0

83 END IF

84

85 RX.Update

86 RX.Close

87

88 curDate = dateadd("d",1,CDATE(curDate))

89

90 LOOP

91

92 '==============================================================

Open in new window

0
Comment
Question by:Data-Base
  • 2
  • 2
5 Comments
 
LVL 39

Expert Comment

by:thenelson
ID: 24753652
Did the error message provide a description? When you click on debug, which line is highlighted?

0
 
LVL 26

Accepted Solution

by:
Shaun Kline earned 500 total points
ID: 24753695
Check out this page: http://classicasp.aspfaq.com/general/why-do-i-get-80020009-errors.html.
Based on the line number provided in the error message, I would guess that your query brought back no data. It is good practice to always verify that data has been returned. See attached code.

If Not RX.BOF And Not RX.EOF Then

  IF RX("type") = 10 THEN

    RX("day") = curDay

    curDay = CurDay + 1

    IF curDay > rotation THEN

      curDay = 1

    END IF

  ELSE

    RX("day") = 0

  END IF

  RX.Update

END IF

Open in new window

0
 

Author Comment

by:Data-Base
ID: 24756925
Hello Thank you

thenelson , That is the only Error message I got!


Shaun_Kline, your code worked, how I did not notice that!
now can I use as the example below? I usually use it to check.

change "If Not RX.BOF And Not RX.EOF Then" with "If RX.RecordCount > 0 Then" ?

and witch one is better?
If RX.RecordCount > 0 Then

  IF RX("type") = 10 THEN

    RX("day") = curDay

    curDay = CurDay + 1

    IF curDay > rotation THEN

      curDay = 1

    END IF

  ELSE

    RX("day") = 0

  END IF

  RX.Update

END IF

Open in new window

0
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 24757195
The one issue that can occur, depending on the type of data source you are using, is that RecordCount is not always populated. (I forget what version of ADO and what data source it was that I ran into this issue.) Checking for BOF and EOF (and truthfully, I only checked for EOF) seems to be consistent.
0
 

Author Closing Comment

by:Data-Base
ID: 31598742
Thanks allot :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now