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

Splitting user input into multiple fields

P: n/a
Hi,

I'm ridiculously new to Access (about a week!) so please be patient!

My database is a record of British Standards. Each has a unique
identifier. Some are split into parts. I would like the user to be
able to input the data into a single textbox using a form like this:

Record1: BS 1490-1
Record2: BS 1490-2
Record3: BS 1495 [this is one that isn't split into parts]
etc...

and for Access to place these records into a table splitting each
record into two fields, "Standard" (text) and "Part" (Long int) as
below:

Standard | Part
BS 1490 | 1
BS 1490 | 2
BS 1495 |

or maybe with "0" in the part column for BS 1495.

Is there a way of getting Access to split the user input into two
fields using the position of the hyphen to govern where (or whether) to
split?

I can ensure that the user always uses a hyphen to delimit (maybe with
an input mask).

Thanks in advance for any help you can give me,

Matt.

Jul 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Study event functions. Use the after update event with the built-in string
functions, instr, len, mid, left, right to split your text and add it to the
fields.

Air code

me![Standard] = left(me![input],instr(1,me![input],"-")-1)
me![Part]=right(me![input],len(me![input])-instr(1,me![input],"-"))

if me![Input] is "BS 1490-1"
Me![Standard] would be "BS 1490"
Me![Part] would be "1"
"Matt" <ma************@gmail.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
Hi,

I'm ridiculously new to Access (about a week!) so please be patient!

My database is a record of British Standards. Each has a unique
identifier. Some are split into parts. I would like the user to be
able to input the data into a single textbox using a form like this:

Record1: BS 1490-1
Record2: BS 1490-2
Record3: BS 1495 [this is one that isn't split into parts]
etc...

and for Access to place these records into a table splitting each
record into two fields, "Standard" (text) and "Part" (Long int) as
below:

Standard | Part
BS 1490 | 1
BS 1490 | 2
BS 1495 |

or maybe with "0" in the part column for BS 1495.

Is there a way of getting Access to split the user input into two
fields using the position of the hyphen to govern where (or whether) to
split?

I can ensure that the user always uses a hyphen to delimit (maybe with
an input mask).

Thanks in advance for any help you can give me,

Matt.

Jul 20 '06 #2

P: n/a
Excellent. That should point me in the right direction. Thanks for
the help.

Matt.

paii, Ron wrote:
Study event functions. Use the after update event with the built-in string
functions, instr, len, mid, left, right to split your text and add it to the
fields.

Air code

me![Standard] = left(me![input],instr(1,me![input],"-")-1)
me![Part]=right(me![input],len(me![input])-instr(1,me![input],"-"))

if me![Input] is "BS 1490-1"
Me![Standard] would be "BS 1490"
Me![Part] would be "1"
"Matt" <ma************@gmail.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
Hi,

I'm ridiculously new to Access (about a week!) so please be patient!

My database is a record of British Standards. Each has a unique
identifier. Some are split into parts. I would like the user to be
able to input the data into a single textbox using a form like this:

Record1: BS 1490-1
Record2: BS 1490-2
Record3: BS 1495 [this is one that isn't split into parts]
etc...

and for Access to place these records into a table splitting each
record into two fields, "Standard" (text) and "Part" (Long int) as
below:

Standard | Part
BS 1490 | 1
BS 1490 | 2
BS 1495 |

or maybe with "0" in the part column for BS 1495.

Is there a way of getting Access to split the user input into two
fields using the position of the hyphen to govern where (or whether) to
split?

I can ensure that the user always uses a hyphen to delimit (maybe with
an input mask).

Thanks in advance for any help you can give me,

Matt.
Jul 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.