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

Populating an option group by recognising 3 digits

P: n/a
Hello this is my first post to this group. I have a form on which the
user enters an eleven digit number the first three of which are a
special prefix. This prefix uniquely identifies an airline. Also on the
form is an option group of handling agents who process freight for
these airlines. Currently the user manually clicks one of the option
group boxes depending on the prefix entered. What I would like to do is
add an event procedure to the After update event which would recognise
the first three digits and populate the option group accordingly. Any
suggestions gratefully received

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


P: n/a
On 21 Jul 2006 15:14:43 -0700, fishhead wrote:
Hello this is my first post to this group. I have a form on which the
user enters an eleven digit number the first three of which are a
special prefix. This prefix uniquely identifies an airline. Also on the
form is an option group of handling agents who process freight for
these airlines. Currently the user manually clicks one of the option
group boxes depending on the prefix entered. What I would like to do is
add an event procedure to the After update event which would recognise
the first three digits and populate the option group accordingly. Any
suggestions gratefully received
Code the AfterUpdate event of the text control:
If Left(Me![ControlName],3) = 123 Then
Me![OptionGroupName] = 1
ElseIf Left(Me![ControlName],3) = 456 Then
Me![OptionGroupName] = 2
Else
Me![OptionGroupName] = 3
End If

If you had lot's more choices Select Case might be easier to use then
If .. Then .. Else
Look it up in VBA help.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Jul 21 '06 #2

P: n/a

fredg wrote:
On 21 Jul 2006 15:14:43 -0700, fishhead wrote:
Hello this is my first post to this group. I have a form on which the
user enters an eleven digit number the first three of which are a
special prefix. This prefix uniquely identifies an airline. Also on the
form is an option group of handling agents who process freight for
these airlines. Currently the user manually clicks one of the option
group boxes depending on the prefix entered. What I would like to do is
add an event procedure to the After update event which would recognise
the first three digits and populate the option group accordingly. Any
suggestions gratefully received

Code the AfterUpdate event of the text control:
If Left(Me![ControlName],3) = 123 Then
Me![OptionGroupName] = 1
ElseIf Left(Me![ControlName],3) = 456 Then
Me![OptionGroupName] = 2
Else
Me![OptionGroupName] = 3
End If

If you had lot's more choices Select Case might be easier to use then
If .. Then .. Else
Look it up in VBA help.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Thanks very much Fred for your suggestion

Jul 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.