Results 1 to 3 of 3

Thread: SEEK/FIND METHODS

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 1999
    Location
    High Wycombe, United Kingdom
    Posts
    13
    I’m trying to use seek/find methods with out a success.
    I have listed my table structures & coding below & hoping to get an answer soon.

    Table names:
    1. AirMain – contains records created from a text file.
    2. InvaliPC- contains only invalid records from this file

    Structure of files
    Airmain InvalidPC
    Address Line1 Addres Line2
    Address Line2 Address Line2
    Town Town
    County County
    PostCode PostCode
    URN ReturnPostcode
    URN

    ** Both files been indexed by URN


    Form Load()
    Set db = DBEngine.OpenDatabase(App.Path & "\AIRTOURS.MDB")
    Set rs = db.OpenRecordset("AIRMAIN", dbOpenDynaset)
    Set rsInvPc = db.OpenRecordset("InvalidPC", dbOpenDynaset)
    End Sub

    After extracting records from InvalidPc to a text file- I’m running an external “postcode cleaning” process to correct these invalid records & generated postcode will be stored under “ReturnPostCode” field.

    Once this process finish, I want to copy only updated recs. (where ReturnPostCode<>””) to the AirMain table.
    This is my coding to do a search on Airmain table

    Dim u
    While Not rsInvPc.EOF
    u = rsInvPc.Fields("urn")
    rs.FindFirst "URN =" & u
    If rs.NoMatch Then
    MsgBox "Cannot"
    MsgBox rs.PercentPosition
    End If
    ‘ rs.Seek "=", u
    ' MsgBox rs.PercentPosition
    rsInvPc.MoveNext
    Wend

    (This always return a 0 (zero) for rs.PercentPosition)

    Can any one tell me where/what’s wrong with this code?
    Any help will greatly appreciate.
    Thanks

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    If URN is a text field:

    Change this:
    rs.FindFirst "URN =" & u


    To this:
    rs.FindFirst "URN = '" & u & "'"

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 1999
    Location
    High Wycombe, United Kingdom
    Posts
    13

    SEEK/FIND METHOD

    Clunietp
    Thank you very much for your reply. It works.
    Niranjan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width