If / Then/ Where ?

T

Tammy

I have a form with 4 combo boxes. Each combo box stores a piece of info
into the table. But I need to be able to restrict what the users are
selecting. For example if the field Service is selected, then I need the
field NonService to be null. Also if my field Service is selected, I need
field Product and field ConcernDetail to NOT be null. Then likewise is
NonService is selected, I need field Product, ConcernDetail and Service to
EQUAL null.
Can anyone help?
Thanks a lot!
 
S

Sreedhar

Hi,

If I understand the question correctly, you don't need two fields for
"Service" and "NonService". Instead, have one field for storing this value,
or even better, an option group. Then, it's pretty easier to handle the other
fields. You can try the following untested code in your form.

If Me!OptionGroupName.Value = 1 Then '(Service)
If IsNull(Me!Product) Then Me!Product.SetFocus
If IsNull(Me!ConcernDetail) Then Me!ConcernDetail.SetFocus
Else '(NonService)
Me!Product.Enabled = False
Me!ConcernDetail.Enabled = False
End If

You can also throw in some messages to inform the User of what you require.
 

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

Top