Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete text in a table

Status
Not open for further replies.

samotek

Technical User
May 9, 2005
197
BG
Is it possible to delete by code all the data in the table field that are not numerical ? For example one row in the field F7 consists of the following
Invoice 4567999
Is it possile to delete the letters invoice in this row ?
 
If the word is always Invoice, you can use:

Replace(F7,"Invoice ","")

If there is always a single start word:

Mid(F7,Instr(F7," ")+1)

If there is always a single end number:

Mid(F7,InstrRev(F7," ")+1)

If the number could occur anywhere in a sentence, you can use split:

Code:
asF7=Split(F7," ")
For i=0 to Ubound(asF7)
   If IsNumeric(asF7(i)) Then
      r=asF7(i)
   End If
Next

If the number is tangled with letters, you can examine by character:

Code:
For i=0 to Len(F7)
   If IsNumeric(Mid(F7,i,1)) Then
      r=r & Mid(F7,i,1)
   End If
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top