I am importing a text file that contains timekeeping job charges, hours, names and shifts. The first seven fields, using the TransferText routine, came in find. The remaining fields contain tabs and spaces that I want to remove. How do I do this?<br>Also I have one field that contains the hours, name and shift and I want to break them up into individual fields but the information came into the database unevenly, for example:<br> st ot dt name shift<br>360016000000tabSMITH, JOHN W. 1<br> 240008000000tabJONES, ARNOLD C. 2<br><br>I have a FoxPro 2.5 program that works great for bringing in the data but we are going away from FoxPro. Here is the entire routine: Is there a way of modifying this program to work in Access97?<br><br>set echo off<br>set talk off<br>close databases && make sure dbf's are closed<br>use IBMTIME && open IBMTIME.dbf<br>DELETE ALL && Delete all records<br>PACK<br>txt_file = GETFILE('JCN', 'Open Source text file:') && open dialog window select file<br>fptr = FOPEN(txt_file) && load text file into fptr<br>IF fptr < 0 && test file to see if already<br> @ 10,0 say "Can't open or create output file" && open, if so cancel program<br> RETURN<br>ENDIF<br><br>DO WHILE !FEOF(fptr) && repeat routine until EOF<br> APPEND BLANK && put a blank record in dbf<br> <br> in_string = FGETS(fptr) && load line of text<br> <br> ***************************************************************************<br> ** detect and store perm number **<br> the_field = field(1) && perm<br> replace &the_field with substr(in_string,1,6) && detect text at column 1<br> && width of 6<br> ***************************************************************************<br> ** detect and store number of entries **<br> the_field = field(2) && no. of entries<br> replace &the_field with substr(in_string,7,7) && detect text at column 7<br> && width of 7<br> ***************************************************************************<br> ** detect date add slashes between month day year then store **<br> the_field = field(3) && date<br> test_field = substr(in_string,14,6) && detect text at column 14<br> && width of 6<br> test_field = STUFF(test_field,3,0,"/" && insert / between month and day<br> test_field = STUFF(test_field,6,0,"/20" && insert / between day and year<br> replace &the_field with test_field && store text info into dbf<br> *************************************************************************** <br> ** detect and store cost center **<br> the_field = field(4) && cost center<br> replace &the_field with substr(in_string,20,2) && detect text at column 20<br> && width of 2<br> ***************************************************************************<br> ** detect and store plant number **<br> the_field = field(5) && plant<br> replace &the_field with substr(in_string,22,3) && detect text at column 22<br> && width of 3<br> *************************************************************************** <br> ** detect and store department number **<br> the_field = field(6) && department<br> replace &the_field with substr(in_string,25,4) && detect text at column 25<br> && width of 4<br> ***************************************************************************<br> ** detect and store project, jcn and sub job charge **<br> y = 1 && start value for column<br> z = 3 && value of field width<br> for x = 7 to 9 && field number<br> <br> test_field = substr(in_string,29,12) && detect text at column 29<br> && width of 12<br> test_field = chrtran(test_field,' ',' ') && replace tab with space<br> && remove spaces to left<br> test_field = substr(test_field,y,z) && detect field determined by y and z<br> the_field = field(x) && proj(7) jcn(8) sub(9) fields<br> replace &the_field with test_field && store text info into dbf field<br><br> do case<br> case x = 7 && if x = 7 jcn field<br> y = 4 && column = 4 29 + 4<br> z = 5 && width = 5<br> case x = 8 && if x = 8 sub field<br> y = 9 && column = 9 29 + 9<br> z = 3 && width = 3<br> endcase<br> <br> next x<br> *************************************************************************** <br> ** straight time, overtime and double time **<br> y = 1 && start value for column<br> for x = 11 to 13 && field number<br> <br> test_field = substr(in_string,40,20) && detect text at column 40<br> && width of 20<br> test_field = ltrim(chrtran(test_field,' ',' ')) && replace tab with space<br> && remove spaces to left<br> test_field = substr(test_field,y,4) && detect first four characters<br> test_field = val(test_field)/100 && detect number from text<br> test_field = str(test_field,4,1) && convert number to text<br> the_field = field(x) && st(11) ot(12) dt(13)<br> replace &the_field with test_field && store text info into dbf field<br><br> y = y + 4<br> next x<br><br> *************************************************************************** <br> the_field = field(10) && name<br> test_field = substr(in_string,55,24) && detect text at column 55<br> && width of 24<br> test_field = chrtran(test_field,' ',' ') && replace tab with space<br> test_field = strtran(test_field,'0','') && replace 0 with blank<br> test_field = strtran(test_field,'1','') && replace 1 with blank<br> test_field = strtran(test_field,'2','') && replace 2 with blank<br> test_field = strtran(test_field,'3','') && replace 3 with blank<br> test_field = alltrim(test_field) && remove remaining spaces<br> replace &the_field with test_field<br> ***************************************************************************<br> the_field = field(14) && shift<br> test_field = substr(in_string,70,20) && detect text at column 70<br> && width of 20<br> test_field = chrtran(test_field,' ',' ') && replace tab with space<br> test_field = chrtran(test_field,'A',' ') && replace A with space<br> test_field = chrtran(test_field,'B',' ') && replace B with space<br> test_field = chrtran(test_field,'C',' ') && replace C with space<br> test_field = chrtran(test_field,'D',' ') && replace D with space<br> test_field = chrtran(test_field,'E',' ') && replace E with space<br> test_field = chrtran(test_field,'F',' ') && replace F with space<br> test_field = chrtran(test_field,'G',' ') && replace G with space<br> test_field = chrtran(test_field,'H',' ') && replace H with space<br> test_field = chrtran(test_field,'I',' ') && replace I with space<br> test_field = chrtran(test_field,'J',' ') && replace J with space<br> test_field = chrtran(test_field,'K',' ') && replace K with space<br> test_field = chrtran(test_field,'L',' ') && replace L with space<br> test_field = chrtran(test_field,'M',' ') && replace M with space<br> test_field = chrtran(test_field,'N',' ') && replace N with space<br> test_field = chrtran(test_field,'O',' ') && replace O with space<br> test_field = chrtran(test_field,'P',' ') && replace P with space<br> test_field = chrtran(test_field,'Q',' ') && replace Q with space<br> test_field = chrtran(test_field,'R',' ') && replace R with space<br> test_field = chrtran(test_field,'S',' ') && replace S with space<br> test_field = chrtran(test_field,'T',' ') && replace T with space<br> test_field = chrtran(test_field,'U',' ') && replace U with space<br> test_field = chrtran(test_field,'V',' ') && replace V with space<br> test_field = chrtran(test_field,'W',' ') && replace W with space<br> test_field = chrtran(test_field,'X',' ') && replace X with space<br> test_field = chrtran(test_field,'Y',' ') && replace Y with space<br> test_field = chrtran(test_field,'Z',' ') && replace Z with space<br> test_field = chrtran(test_field,'.',' ') && replace . with space<br> test_field = chrtran(test_field,',',' ') && replace , with space<br> test_field = alltrim(test_field) && remove remaining space<br> test_field = val(test_field) && detect number from text<br> test_field = str(test_field,1,1) && convert number to text<br> replace &the_field with test_field<br><br>enddo<br>=fclose(fptr)<br>******************************************************************************<br>*DELETE ALL FOR proj < "052" OR (proj > "052" AND proj < "380" OR proj > "399" && Delete all records < dept 390<br>PACK<br><br>close all<br><br>*return<br>