Niranjan Wickramartne
Apr 4th, 2000, 01:36 PM
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
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