Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2008

Tip: Looking for answers? Try searching our database.

Problem with find

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amduke - 21 May 2008 10:01 GMT
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
Amduke - 21 May 2008 15:33 GMT
Hello guys,

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

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

That is the solution

> Hello,
>
[quoted text clipped - 54 lines]
>    
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.