|
-
Dec 30th, 2007, 10:28 PM
#1
Thread Starter
Frenzied Member
-
Dec 30th, 2007, 10:32 PM
#2
Addicted Member
Re: Run time error 3021
1) check out the connection state. is it close or open i.e. consys
2) Before moving to the first record, checkout is there any record in the recordset.
Do Good. Be Good. The World is yours.
-
Dec 30th, 2007, 10:44 PM
#3
Thread Starter
Frenzied Member
Re: Run time error 3021
I got this error message when I selecting the last record in the listview. The is not problem is I select next record or first record in listview. I do like this, but still got the error..
Code:
Private Sub ListView6_ItemClick(ByVal item As MSComctlLib.ListItem)
tablesys.Close
tablesys.Open "Select ID,Plot,Kod from yieldraster", consys, adOpenDynamic,adLockOptimistic
tablesys.MoveFirst
If Not tablesys.BOF And Not tablesys.EOF Then
tablesys.Move CLng(item.Index - 1)
getID = tablesys.Fields("id").Value
Text19.Text = tablesys.Fields("Plot").Value & ""
Text20.Text = tablesys.Fields("Kod").Value & ""
Else
MsgBox "No data returned."
End If
End Sub
How to check connection state?
-
Dec 31st, 2007, 12:58 AM
#4
Addicted Member
Re: Run time error 3021
to check connection state.
Connestion.state
adStateOpen
adStateClose
Do Good. Be Good. The World is yours.
-
Dec 31st, 2007, 01:05 AM
#5
Re: Run time error 3021
Two other possibilities:
1. No records were returned from the SELECT (EDIT: but I see you're now checking that)
2. Item.Index = 0 or greater than 1 more than the number of records returned
Last edited by Doogle; Dec 31st, 2007 at 01:09 AM.
-
Dec 31st, 2007, 01:34 AM
#6
Thread Starter
Frenzied Member
Re: Run time error 3021
I make a backup .
I have more then 1000 record in the listview. It work after I delete the records. Now the record in the database is 500 records. Why I got the error message more then 500 record in database?
Last edited by matrik02; Dec 31st, 2007 at 01:47 AM.
-
Dec 31st, 2007, 01:41 AM
#7
Re: Run time error 3021
With the way you're processing the data there has to be a one-to-one relationship between Item.Index and the database records. ie if you have 100 records on the Datatbase, Item.Index cannot be greater than 101.
-
Dec 31st, 2007, 02:47 AM
#8
Thread Starter
Frenzied Member
Re: Run time error 3021
I delete the record from 1900 and left the record to 500 records.. It work.. But more than 500 records I got the error.. Why?It suppose work without error for 1900 records.
Let say, I select the end record "1900", I got the error.. But for 500 records, I select at the end of the records, It work find.
-
Dec 31st, 2007, 03:17 AM
#9
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|