if/then

T

Tammy

Hi - hope someone can help me.
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!
 
J

Jeff Boyce

Tammy

It sounds to me like you have a variety of conditions to test and validate
before saving the record in the form.

You can use the form's BeforeUpdate event to test all these, and to set
Cancel=True to bail out without saving.

Good luck

Jeff Boyce
Microsoft Office/Access MVP
 
T

Tammy

jeff - could you be any more specific?
thanks

Jeff Boyce said:
Tammy

It sounds to me like you have a variety of conditions to test and validate
before saving the record in the form.

You can use the form's BeforeUpdate event to test all these, and to set
Cancel=True to bail out without saving.

Good luck

Jeff Boyce
Microsoft Office/Access MVP
 
J

Jeff Boyce

Tammy

Perhaps one of the newsgroup's other readers can spend the time needed to
design and build the validation code, but I'm afraid I can't.

Are you familiar with using "code behind forms"? You'd need to be able to
create an event procedure to run when the form's BeforeUpdate event is
triggered.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

DMV

what I understand is if combo box 1(cbo1) ="service" then combo box 2
(cbo2)=null. if this is true then you need to write code behind the combo
box 1 in the After Update. you need to write select statements for the
rowsource.
EXAMPLE:
if cbo1="service" then
cbo2.rowsouce =null else
if cbo1="department" then
cbo2.rowsource = "select name from tblcompany where name ='department'"
end if

you can continue on if cbo2 equals a statement then cbo3 will equal
something else. you may need to refresh the preceeding combo box after the
first has been selected I cant really remember. either that or the
underlying query for the combo box you can reference the previous combo box
(forms!frmmain!cbo1)
 

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