Please Help: Combo Boxes

cmina

New member
Local time
Today, 21:14
Joined
Mar 21, 2001
Messages
9
I'm using Access2000.
I have two combo boxes on a form.
The first one has 2 items (say A & B)
and the second one has also 2 items
(say C & D).
When I choose item A on combo1 the other
combo becomes hidden. When I choose
item B on combo1 then combo2 appears and
I can choose items C or D.
Default value for combo1 is item A.
Now the problem I have is the following:
When I choose value B from combo1 and move
to the next record, combo2 does not get
hidden (as it should since it gets the
default value for it, i.e. item A).
How can I refresh the form after I move to
a new record or do something about it so
the form will show the combo boxes correctly.

Here is the code for AfterUpdate for combo1:

Private Sub combo1_AfterUpdate()
' This is Unfinished!
' Find a solution to this
' When changing field it doesn't updates

Select Case combo1.Value
Case "B"
labelcombo2.Visible = True
combo2.Visible = True
Case "A"
labelcombo2.Visible = False
combo2.Visible = False
Case Else
' Something is Wrong!
End Select

Me.Refresh

End Sub

Please Help.
Thank you in advance!

CM
 
Try repainting your form afterupdate of your combobox.
 
Thanks for your reply.
I did repaint the form but the problem still
exists. (I added this:
Code:
DoCmd.RepaintObject acForm, "Motor Data"
I need to find a way to refresh/repaint the form when I change records. Any clue how to do this? Thank you in advance.
 
After "Case Else" you need to indicate the visibility status you want for each control when nothing is selected. You may also think about putting your code into the forms "OnCurrent"(record) event.
 
Thank you zunan!
I put my code into the forms "OnCurrent" event and it worked!!!
My appreciation also goes to llkhoutx. For anybody out there might have a similar problem here is the final code:
Code:
Private Sub Form_Current()

Select Case combo1.Value
Case "B"
labelcombo2.Visible = True
combo2.Visible = True
Case "A"
labelcombo2.Visible = False
combo2.Visible = False
Case Else
' Something is Wrong!
End Select

Me.Refresh
DoCmd.RepaintObject acForm, "Motor Data"

End Sub
 
In the OnCurrent event of the form you are referring to when you say "when I move to the next record", ie probably your main form, apply .refresh to the form containing the linked combos (the same main form or a subform in it).

[This message has been edited by Alexandre (edited 03-26-2001).]
 

Users who are viewing this thread

Back
Top Bottom