Question : Want to remove extra numerical information (zip codes, etc.) from a text file that has thousands of addresses to only leave a 10-digit phone number (area code + phone number)?

I have a long list of address information (phone numbers + area code, street addresses, etc.) in a text file on a disc and I want to use Microsoft Access to open the text file and to "clean up" the data so that only the 10-digit phone numbers (there are no hyphens in the numbers) are left. Looking to do this using Accel but also have Excel and I am more expert with Excel.

Answer : Want to remove extra numerical information (zip codes, etc.) from a text file that has thousands of addresses to only leave a 10-digit phone number (area code + phone number)?

YES

replace it with tblPhone

also you might have a blank line in your text file

sub getPhoneNo()
dim rs as Dao.recordset
dim s as string, telPhone
set rs=currentdb.openrecordset("tblPhone")
open "C:\MyText.txt" for input as #1
do until eof(1)
line input #1, s

   if len(s)>10 then
     rs.addnew
     rs("PhoneNumber")=left(s,10)
     rs.update
  end if

loop
close #1

end sub


Random Solutions  
 
programming4us programming4us