Problem with find

A

Amduke

Hello,

can someone help me out with a "Find" problem.
Hereafter you find the code I've written to check wether an article is
already in a table or not.
Therefor I've used the "recordset.Find" object.
The problem I'm facing is that no equal record is detected as found.
In the script I build a control to find out wheter the cursor is at the end
of the file (EOF) or not.
Normaly I should presume that the article will be found because I previously
made a copy of the first table (rs_Ord) via a make table query. So the field
is of the same type and the content is also an exact copy.
Can somebody help me out of this?

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")
m_Koko = rs_Ord.Fields("Koko")
rs_Spok.MoveFirst
SrchStr = "[CART] = """ & m_Mabc & """"
'Search for article code in SPOK file
rs_Spok.Find SrchStr
If rs_Spok.EOF = True Or rs_Spok.BOF = True Then
'At this point rs_SPOK.EOF is always true although the content
'of rs_Ord and rs_Spok are identical. I created a new Table Spok
'via a make table query out of table Ord.
'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
 
A

Amduke

Hello guys,

I solved the problem myself.
I changed the code of the search string into:

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

That is the solution
 

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