ADO and SEEK Crash (VB6)



Hi All,

i've got a piece of cade made in VB 6. It doesn't work anymore under Xp SP2.
The software is loaded with rs.seek commands. Now the software crashes
under XP
I've added a sample of the code below. The code crashes after a few
iterations of the loop

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rsA As ADODB.Recordset
Dim rsP As ADODB.Recordset
Dim M As Long
Dim n As Long
Dim p1 As String
Dim SQL As String

Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.jet.OLEDB.4.0; Data source=database.pp; Jet
OLEDB:Database Password=dsawertg;"

SQL = "SELECT * FROM Tabel1"
Set rsP = New ADODB.Recordset
rsP.CursorLocation = adUseClient
rsP.Open SQL, conn, adOpenStatic, adLockOptimistic, adCmdText

Set rsA = New ADODB.Recordset
rsA.Index = "LevelA"
rsA.Open "LevelA", conn, adOpenKeyset, adLockReadOnly, adCmdTableDirect

M = 100
Do While M > 0
M = M - 1
lblStatus.Caption = M
DoEvents
p1 = "a"
n = 5
Do While n > 0
n = n - 1

SQL = "SELECT * FROM Level5 ORDER BY ArticleNr_P"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open SQL, conn, adOpenStatic, adLockOptimistic, adCmdText
Do While Not rs.EOF
rsA.Seek rs!ArticleNr_P
'Debug.Print rs!ArticleNr_P
If Not rsA.EOF Then
rsP.AddNew
rsP!naam = p1
rsP.Update
End If
rs.MoveNext
Loop

rs.Close
Set rs = Nothing
Loop
Loop


lblStatus.Caption = "Klaar!"


Tabel1 bevat de velden Naam (String) en ID (Autonummering
Level5 bevat:
Articlenr_P as string
met de volgende waarden
01a11
02a11
03a11
04a11
05a11
06a11
07a11
08a11
09a11
10a11
90a11

LevelA bevat:
Articlenr as string
met de waarden
01a11
02a11
03a11
04a11
05a11
06a11
07a11
08a11
09a11
15a11
16a11
90a11
99a11

Does anyone also has this problem? What have I done wrong??

Cheers, Ray


.



Relevant Pages

  • Re: Looping through Query to create multiple sheets in excel- Just need the loop
    ... I always get to this point and I can't figure out how to loop through ... I have put the string in the query at the bottom. ... Optional strWorkSheet As String, Optional strRange As ... Dim objXLSheet As Object 'Excel.Worksheet ...
    (microsoft.public.access.forms)
  • Re: How is this conditional able to execute?
    ... inside the loop, then each time the loop iterates then a NEW reference to ... Note that the test of returndata is not a type. ... Dim returndata As String = "" ... Not that 'Changing' is only displayed when returndata is NOT an empty string ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How is this conditional able to execute?
    ... Why is this part out of the loop: ... Maybe I just don't understand the returndata = "" because of the byte array. ... How can I read the string in: ... > Dim t As Thread ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Dynamically Update Text Box on-slide with loop (VBA)
    ... the slide. ... checked and strDiff does not get updated during the loop. ... Dim EventDate As Date, curDate As Date ... Dim sDateFile As String ...
    (microsoft.public.powerpoint)
  • DropDownList SelectedIndex problem in C# (from working VB.NET)
    ... Private Sub Page_Load(ByVal sender As System.Object, ... Const strConnString As String = ... Dim objConn As New SqlConnection ... SqlConnection conn = new SqlConnection; ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)