By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Parsing text

P: n/a
Ray
I have a textbox which contains one of three lots of text -

'Female','Male',
or
'Female',
or
'Male',

I would like to parse the above, which includes the apostrophes and
commas in to two single text boxes which would either return Female or
Male or "". Can this be done anyone? TIA - Ray
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If you are using Access version 2000, or greater, you can use the
Split() function to put the comma-delimited string items into an
array.

== VBA air code ==

dim s(1) as string
s = split(Me!ToParse, ",")
Me!Text1 = Replace(s(0),"'","")
me!Text2 = Replace(s(1),"'","")

== end air code ==

The control ToParse would be the TextBox that contains the original
value.

See the Access help articles on the Split Function and the Replace
Function.

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP/FlnIechKqOuFEgEQLgtgCgjc3cyzO3wGPkoUSpmWvTTl/WMzsAnjti
3il3LkNygtpold53rSvgmMJu
=7pWs
-----END PGP SIGNATURE-----
Ray wrote:
I have a textbox which contains one of three lots of text -

'Female','Male',
or
'Female',
or
'Male',

I would like to parse the above, which includes the apostrophes and
commas in to two single text boxes which would either return Female or
Male or "". Can this be done anyone? TIA - Ray


Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.