Error 3001 in find in recordset

A

Amduke

Hello all,

hoping to find some solutions over here.

The problem I encounter is that during running the loop trough the recordset
rs_Ord, an error message pops up at record 2366 when I'm at possition:
rs_Spok.Find (SrchStr); indicated with comment.
The error message is: Run-time error '3001':
Arguments are of the wrong type, ar out of acceptable range, or are
inconflict with one another.


Public Sub WriteToRsKokoNoSpok()

'Populate the specified table with data out of the recordset(s)

If rs_Ord.RecordCount > 0 Then
rs_Spok.MoveFirst
tst = rs_Spok.Fields("cart").Value
rs_Ord.MoveFirst
x = 0
y = 0
If rs_Ord.RecordCount > 0 Then
Do Until rs_Ord.EOF
Ord_recpos = rs_Ord.AbsolutePosition
m_Mabc = rs_Ord.Fields("CORARK").Value
m_Koko = rs_Ord.Fields("Koko").Value
rs_Spok.MoveFirst
SrchStr = "[CART] = " & m_Mabc '& " ' "
'Search for article code in SPOK file
rs_Spok.Find (SrchStr) !! Error pops up here at rs_ord
recordno 2336 !!
SPOK_recpos = rs_Spok.AbsolutePosition
If rs_Spok.EOF = True Or rs_Spok.BOF = True Then
'No article found in SPOK, add record to KokoNoSpok file
rs_KNS.Find (SrchStr)
KNS_recpos = rs_KNS.AbsolutePosition
If rs_KNS.EOF = False Then
'No action, article already available CART
Else
'Append new record
rs_KNS.AddNew
rs_KNS.Fields("CART") = m_Mabc
rs_KNS.Fields("KOKO") = m_Koko
rs_KNS.Update
End If
Else
'No action, article already planned in SPOK
End If
rs_Ord.MoveNext
Loop
End If
End If

End Sub
 
P

Paolo

Hi Amduke,
perhaps till record 2366 m_Mabc is numeric so your search criteria could
work and then in record 2366 there's something alphanumeric that make your
criteria unaccetable so try to initialise your criteria in this way:

SrchStr = "[CART] =""" & m_Mabc & """"

HTH Paolo
 
A

Amduke

Paolo,
thank you for your answer. It works now.
Btw, I checked the content of the variable m_mabc by looking into the table
and except from a few records, all records are alphanumeric.

Thanks again for the quick and reliable solution.

Paolo said:
Hi Amduke,
perhaps till record 2366 m_Mabc is numeric so your search criteria could
work and then in record 2366 there's something alphanumeric that make your
criteria unaccetable so try to initialise your criteria in this way:

SrchStr = "[CART] =""" & m_Mabc & """"

HTH Paolo

Amduke said:
Hello all,

hoping to find some solutions over here.

The problem I encounter is that during running the loop trough the recordset
rs_Ord, an error message pops up at record 2366 when I'm at possition:
rs_Spok.Find (SrchStr); indicated with comment.
The error message is: Run-time error '3001':
Arguments are of the wrong type, ar out of acceptable range, or are
inconflict with one another.


Public Sub WriteToRsKokoNoSpok()

'Populate the specified table with data out of the recordset(s)

If rs_Ord.RecordCount > 0 Then
rs_Spok.MoveFirst
tst = rs_Spok.Fields("cart").Value
rs_Ord.MoveFirst
x = 0
y = 0
If rs_Ord.RecordCount > 0 Then
Do Until rs_Ord.EOF
Ord_recpos = rs_Ord.AbsolutePosition
m_Mabc = rs_Ord.Fields("CORARK").Value
m_Koko = rs_Ord.Fields("Koko").Value
rs_Spok.MoveFirst
SrchStr = "[CART] = " & m_Mabc '& " ' "
'Search for article code in SPOK file
rs_Spok.Find (SrchStr) !! Error pops up here at rs_ord
recordno 2336 !!
SPOK_recpos = rs_Spok.AbsolutePosition
If rs_Spok.EOF = True Or rs_Spok.BOF = True Then
'No article found in SPOK, add record to KokoNoSpok file
rs_KNS.Find (SrchStr)
KNS_recpos = rs_KNS.AbsolutePosition
If rs_KNS.EOF = False Then
'No action, article already available CART
Else
'Append new record
rs_KNS.AddNew
rs_KNS.Fields("CART") = m_Mabc
rs_KNS.Fields("KOKO") = m_Koko
rs_KNS.Update
End If
Else
'No action, article already planned in SPOK
End If
rs_Ord.MoveNext
Loop
End If
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top