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

Using a combo box value to change a checkbox

P: n/a
I have a form (Form1) with a combo box (Combo43) with three values:

Reference 1
Antenatal 1
Quant 1

I also have two check boxes (check36 and check34)

What is the best way to implement such that when Reference 1 is
selected in the combo box, check34 changes from false to true, and
when Antenenal 1 or quant 1 is selected, check 36 changes to true?
I've tried something along the lines of:

Private Sub Combo43_AfterUpdate()
If Me.Combo43 = "Reference 1" Then
Me.Check32 = True
Else
Me.Check32 = False
End If
End Sub

I'm a beginner at this, so any help would be amazing. Thanks!

Aug 10 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
What is the problem your running into? That's the way I would of done
it, but from the looks of your code you identified the object but not
the property your trying to alter try:

If Me!Combo43.Value = "Reference 1" Then
Me!Check32.Value = True
Else
Me!Check32.Value = False
End If

Aug 10 '07 #2

P: n/a
Your code as shown should work (it did for me).
So, what could be wrong?
Does the Source of your combo box have more than 1 column.
Look at the Properties of your Combo box. On the format tab, How many
columns are there?
If more than 1 column, in Column Widths does it look like this 0";1";1; ?
If so your Combo box is displaying Column 2 but is probably bound to the
first (hidden - 0 length) column.
I suspect this is the case as Access tries to hide the first column if it is
a primary key.

If so, your code should read like this (to confuse matters further, when it
comes to vba the first column of a combo box is 0, the second column is 1,
etc.)
Private Sub Combo43_AfterUpdate()
If Me.Combo43.column(1) = "Reference 1" Then
Me.Check32 = True
Else
Me.Check32 = False
End If
End Sub

Good Luck
Len Robichaud

<ke********@gmail.comwrote in message
news:11*********************@d30g2000prg.googlegro ups.com...
>I have a form (Form1) with a combo box (Combo43) with three values:

Reference 1
Antenatal 1
Quant 1

I also have two check boxes (check36 and check34)

What is the best way to implement such that when Reference 1 is
selected in the combo box, check34 changes from false to true, and
when Antenenal 1 or quant 1 is selected, check 36 changes to true?
I've tried something along the lines of:

Private Sub Combo43_AfterUpdate()
If Me.Combo43 = "Reference 1" Then
Me.Check32 = True
Else
Me.Check32 = False
End If
End Sub

I'm a beginner at this, so any help would be amazing. Thanks!

Aug 10 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.