Text Field

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

I ahev a text field in my table that display quantities like this, (5 EA, 16
PAC, 1,000 EA). There is always a space after the number. How do I strip
everything to the right of the space (i.e. EA, PAC) so I can then convert
this field to a number?
Thanks,
 
Left([YourTextField], InStr([YourTextField]," ")-1)

and for the right part use --
Mid([YourTextField], InStr([YourTextField]," ")+1)
 
I ahev a text field in my table that display quantities like this, (5 EA, 16
PAC, 1,000 EA). There is always a space after the number. How do I strip
everything to the right of the space (i.e. EA, PAC) so I can then convert
this field to a number?
Thanks,

It's not actually necessary to do so: Val([fieldname]) will extract just the
leading number.
 
The following will remove all non-numeric characters from a string

Code:
Public Function fSaveNumer2(pPhone As String) As String[/QUOTE]

Just so the OP knows that this function returns a string, and they must use
Val() or CInt() or CCur() to convert it to a number (or currency).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top