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

4 possible options (based on value combination from 2 combo boxes)

P: 3
hi,

on my form there are 2 combos (ms access)

combo1 contains values: 1, 2, 3, 4, 5
combo2 contains values: a, b, c, d, e

if you choose 1 or 2 or 3 from combo1 and a or b from combo 2 it should make label1 visible

if you choose 4 or 5 from combo1 and a, b, c, from combo2 it should make label1 visible & label2 visible

if 4 or 5 & d or e make label2.visible = true

else
label2.visible = false
label1.visible = false

any idea how to make this working? (my problem is writing of the conditions
Oct 10 '07 #1
Share this Question
Share on Google+
1 Reply


nico5038
Expert 2.5K+
P: 3,072
hi,

on my form there are 2 combos (ms access)

combo1 contains values: 1, 2, 3, 4, 5
combo2 contains values: a, b, c, d, e

if you choose 1 or 2 or 3 from combo1 and a or b from combo 2 it should make label1 visible

if you choose 4 or 5 from combo1 and a, b, c, from combo2 it should make label1 visible & label2 visible

if 4 or 5 & d or e make label2.visible = true

else
label2.visible = false
label1.visible = false

any idea how to make this working? (my problem is writing of the conditions
I would probably create a table with 3 fields:
Combination TEXT (being 1a, 1b, 1c, etc)
Label1 Boolean (YesNo field holding True or False)
Label2 Boolean (YesNo field holding True or False)

Now you can put all combinations in the table and use the value for label1 and label2 to set the correct value, like:

Me.label1.visible = NZ(Dlookup("label1","tblLabels","Combination='" & me.combo1 & me.combo2 & "'"),False)
Me.label2.visible = NZ(Dlookup("label1","tblLabels","Combination='" & me.combo1 & me.combo2 & "'"),False)

The Dlookup will return nothing when a combination isn't found and the NZ() function will set then the default value to False. This way combinations not needing a label1 and/or label2 don't have to be defined in the table.

Idea ?

Nic;o)
Oct 10 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.