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

MS Access data validation combo list text length restriction

P: n/a
Is it possible to restrict the length of a text box in MS Access using
VBA on condition to what is selected in a list combo box.

Scenario:

1. I have a list combo box containing:

AA
BBB
CCCC
DD1
HAXX
123

2. I have a empty text box called A.
3. Upon selecting a option from the list combo box, the list value
selected will be moved to text box A. In addition, depending on what is
selected and moved from the list combo box, the length of text box A
will vary.

Combo
List End Result in text box A
------------------------------------------------------------------------------------------------------------------------
AA = AA and additional 6 digits = Total 8 characters in length of
the text box A
BBB = BBB and additional 8 digits = Total 11 characters in length
of the text box A
CCCC = CCC and additional 8 digits = Total 12 characters in length
of the text box A
DD1234 = DD1234 and additional 4 digits = Total 10 characters in
length of the text box A
HAXX = HAXX and additional 7 digits = Total 11 characters in length
of the text box A
123 = 123 and additional 5 digits = Total 8 characters in length of
the text box A
Is this doable?

Many thanks in Advance.

Kind regards...

Brenda

Jul 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
SDL
If all you want is the length of the resulting data just use the
Len(strName) to get the length of the string field. I believe this will
work. If you need to know where the data ends to apend the digits you
talk about you could also parse the field using string commands. I
guess the question is what are you trying to accomplish?

If you field in Text box A is called strTextBoxA try:

Dim TextBoxLen As Long
TextBoxLen = Len(strTextBoxA)

See if that varies with that data and gives you what you need.

Jul 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.