From: shmoussa on 31 Mar 2010 09:39 Hi, I currently have this code in AfterUpdate event for Combo2, hoping it would change label1, but it does not work. : If Me.Combo1.Value = "State" And Me.Combo2.Value = "2008" Or "2007" Or "2006" Then Me.Label1.Caption = "Select a State:" ElseIf Me.Combo1.Value = "City" And Me.Combo2.Value = "2009" Or "2010" Or "2011" Then Me.Label1.Caption = "Select a City:" Else Me.Label1.Caption = "Select a Number:" End If The label does not change when I make changes to the combo1 and combo2 selections. Any ideas? Thanks
From: Keith Wilby on 31 Mar 2010 11:00 On 31 Mar, 14:39, shmoussa <shmou...(a)gmail.com> wrote: > Hi, > > I currently have this code in AfterUpdate event for Combo2, hoping it > would change label1, but it does not work. : > > If Me.Combo1.Value = "State" And Me.Combo2.Value = "2008" Or "2007" Or > "2006" Then > Me.Label1.Caption = "Select a State:" > ElseIf Me.Combo1.Value = "City" And Me.Combo2.Value = "2009" Or "2010" > Or "2011" Then > Me.Label1.Caption = "Select a City:" > Else > Me.Label1.Caption = "Select a Number:" > End If > > The label does not change when I make changes to the combo1 and combo2 > selections. > > Any ideas? > > Thanks Try the following syntax: Me.Combo2.Value = "2008" Or Me.Combo2.Value = "2007" Or Me.Combo2.Value = "2006" although hard coded values are a bad thing IMO. Keith. www.keithwilby.co.uk
From: shmoussa on 31 Mar 2010 18:09 On Mar 31, 11:00 am, Keith Wilby <keith.wi...(a)baesystems.com> wrote: > On 31 Mar, 14:39, shmoussa <shmou...(a)gmail.com> wrote: > > > > > > > Hi, > > > I currently have this code in AfterUpdate event for Combo2, hoping it > > would change label1, but it does not work. : > > > If Me.Combo1.Value = "State" And Me.Combo2.Value = "2008" Or "2007" Or > > "2006" Then > > Me.Label1.Caption = "Select a State:" > > ElseIf Me.Combo1.Value = "City" And Me.Combo2.Value = "2009" Or "2010" > > Or "2011" Then > > Me.Label1.Caption = "Select a City:" > > Else > > Me.Label1.Caption = "Select a Number:" > > End If > > > The label does not change when I make changes to the combo1 and combo2 > > selections. > > > Any ideas? > > > Thanks > > Try the following syntax: > > Me.Combo2.Value = "2008" Or Me.Combo2.Value = "2007" Or > Me.Combo2.Value = "2006" > > although hard coded values are a bad thing IMO. > > Keith.www.keithwilby.co.uk- Hide quoted text - > > - Show quoted text - Thank you! Works
|
Pages: 1 Prev: Time Value Multiplied for Round Trip Calculation Next: Opening the form |