Change Label based on Two Combo Boxes

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
0
shmoussa
3/31/2010 1:39:35 PM
access.formscoding 7493 articles. 0 followers. Follow

3 Replies
515 Views

Similar Articles

[PageSpeed] 18

On 31 Mar, 14:39, shmoussa <shmou...@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
0
Keith
3/31/2010 3:00:02 PM
high quality Soccer jerseys NBA Jersey tracksuit and jackets, GHD 
hairstraightener supplier from www.willpa.com

Are you a Retail businessman who bother by the purchase price?  China 
Cheapest TOP wholesale website can help you

we are specialize in replica sport goods manufacturing in china, we can 
offer you all kinds of soccer jersey, NBA jersey,shoes and so on. they are 
the best brand replica goods whih are look the same as the original goods. 
excellent quality and steady supply for them. we have been marketed in Europe 
and American for 3 year. all the goods we offer are AAA quality.  our soccer 
jersey are Thailand style. If any goods you buy from my company have problem, 
we will refund or resend them again. Most of ourProducts have no minimum 
order requirements,soyou can shop retail goods at wholesale prices. if you 
can buy more than 300usd. We offer free shipping. The more you buy the more 
discount for you.

National soccer jerseys: http://www.willpa.com
Club soccer jerseys: http://www.willpa.com
NBA Jerseys: http://www.willpa.com
T-shirt and shirt: http://www.willpa.com
Tracksuit: http://www.willpa.com
Hoody & Jackets: http://www.willpa.com
UGG boots: http://www.willpa.com
Hair style: http://www.willpa.com
shopping Index: http://www.willpa.com

EMS shipping.  7days arrive, paypal accept

want more information pls contact us or check our website: www.willpa.com
0
Utf
3/31/2010 8:10:11 PM
On Mar 31, 11:00=A0am, Keith Wilby <keith.wi...@baesystems.com> wrote:
> On 31 Mar, 14:39, shmoussa <shmou...@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 =3D "State" And Me.Combo2.Value =3D "2008" Or "2007"=
 Or
> > "2006" Then
> > Me.Label1.Caption =3D "Select a State:"
> > ElseIf Me.Combo1.Value =3D "City" And Me.Combo2.Value =3D "2009" Or "20=
10"
> > Or "2011" Then
> > Me.Label1.Caption =3D "Select a City:"
> > Else
> > Me.Label1.Caption =3D "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 =3D "2008" Or Me.Combo2.Value =3D "2007" Or
> Me.Combo2.Value =3D "2006"
>
> although hard coded values are a bad thing IMO.
>
> Keith.www.keithwilby.co.uk- Hide quoted text -
>
> - Show quoted text -

Thank you! Works
0
shmoussa
3/31/2010 10:09:54 PM
Reply:

Similar Artilces:

Paste Special Changes Content
Greetings - I am attempting to copy and link, via Past Special, a group of rows within the same workbook. When I do, all the empty cells are populated with zeros. I am using Windows 200 and Office XP. Thanks in advance, Bill When you paste special|Links, you end up with a formula like: =x99 If x99 is empty, then excel will show a 0. But you can change your formula to look like this: =if(x99="","",x99) (if x99 is empty, then make the cell look empty, else just show what's in x99.) Bill wrote: > > Greetings - I am attempting to copy and link, via Pas...

format changes when copying from one cell to another
I'm sure this is simple, but it is not clear to me... I am copying the contents of a group of cells that exist on one worksheet to another. In Sheet2, I tell cell A1 that it should equal Sheet1's A1 value. That works fine. But if the cell is blank on Sheet1, it comes up as "0" on Sheet2. I figured it was probably assuming numeric formatting, but when I right-click > format cell on both Sheet1 and Sheet2, both show up as "general", so why would Sheet2 take a blank value and populate it with "0" ?? I gather than you are putting a formula in one...

Excel 97 dropdown function box
The dropdown function box on the Formula Bar show formulas but will no longer show "More Functions". How can I get this item back? ...

How to change .pst file location on hard drive(s)?
I want to move my .PST file c/w archives to a partition other than C:\. How can I do this with Win Live Mail? Thanks, John. "Machinist60" <e_john_wilson.no.spam.@hotmail.com> wrote in message news:hj5s5l$q8r$1@news.eternal-september.org... > I want to move my .PST file c/w archives to a partition other than C:\. > How can I do this with Win Live Mail? > > Thanks, John. I didn't realize WLM utilized the .pst file. I had to convert my .pst file data into the Windows Mail format and then import the data into WLM. Please explain what you...

downloading Avery labels templates
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I am panicking! I do volunteer work for an organization which includes sending out mailings to over 200 people. I usually print mailing labels from Avery label templates. Although I have done it in the past, I am no longer able to download Avery labels from their website. Does anyone else have this problem? Is there a way around it? Downloading anything from anywhere other than a Microsoft site really isn't an Office issue, so I'm afraid you're not likely to find an answer or a solution here... Es...

Transferring Field from Existing Table/limitations and change of d
Thank you in advance for your help! I have two Excel spreadsheets that I successfully imported into Access 2003 and created tables for. I need to add the field from one table to the other, but there is not a direct match in the relationship. The large table uses the Employee ID as the primary key. The smaller table contains one field that lists a subset of these Employee ID numbers (a selection of certain employees). I need to transfer this field to the larger table, but I do not know how to tell Access to match up the corresponding numbers (i.e., the large table lists all employees, bu...

Line Graph with two different data points
Hello, I am trying to create a line chart with numbers from my product Vs a competitor. The problem i am having is how can i make a chart that will have four data points comparing to each other? For example Product A- 1.5 1.2 1.6 1.8 Product B- 2.0 1.1 1.2 1.3 Product A- 70% 20 % 30% 67% Product B- 65% 30% 65% 55% How do i get all of these numbers on one chart? Is a line chart correct. I want to see these numbers compared?? Thank you so much Hi, Since the number don't appear related to the percentages you might plot them on the same chart but two different axes. If they were relate...

Query cross two table
Hi, I have two tables, tbAdmission and tbCode. In my tbAdmission, I have Code1, Code2 and Code3. In my tbCode, I have Code, Description1 and Description2. In my Form, frmAdmission, I have txtCode1, txtCode2 and txtCode3 that are all bounded to tbAdmission. And txtDescription1Code1, txtDescription2Code1, txtDescription1Code2, txtDescription2Code2, txtDescription1Code3 and txtDescription2Code3 that are unbounded and only for displaying the descriptions. txtCode1, txtCode2 and txtCode3 all refer to Code in tbCode to retrieve Description1 and Description2 for displaying in the unbou...

no change pivot item.
i want to can not change pivotitems in the pivotfields. namely pivotitems restircted. How can I do in VBA? *** Sent via Developersdex http://www.developersdex.com *** ...

Data changes when Analyzed with Excel
I have a query with 3 tables that represent master item list, count qty and as qty. When I look at the results in Query, all is well and accurate yet when I select Analyze with Excel, values change. For example, if a record shows zero qty in the as of field and zero quantity in the count field, I get a value in one or both of the fields that origianlly were zero. Other than linking the tables and grouping by master item list (to show all parts regardless of qty's), there are no formulas or expressions in this query. One of the tables is linked to a FoxPro table via ODBC driver. ...

validation list or combo box dependant on cell value
Am i able to determine the values shown in either a validation list or combo box being dependant on a value in another cell? ie: Cell A1 = BOB then validation or combo box would then base it's list from the named range (or whatever the solution may be) based on Bob. if i was to change A1 to ROY then it would also change the underlying list? I have tried everything that i think SHOULD work but that it pretty limited... thanks in advance rich I'd start with Debra Dalgleish's site: http://contextures.com/xlDataVal02.html Richard Edwards wrote: > > Am i able to deter...

worksheet labels based on cell results
How can I build a macro to use the contents of several cells in a column to label a corresponding number of worksheets with their contents. Ideally this would also build links to the tabs so that a user could click on a specific cell (in that column) and be redirected to the corresponding worksheet Thanks, Mitch Hi for labeling the tab try something like activesheet.name=activesheet.range("A1").value For the second question try using a Hyperlink (Insert - Hyperlink) -- Regards Frank Kabel Frankfurt, Germany Mitch wrote: > How can I build a macro to use the contents of ...

Help me create sales chart based on state and quantity
We have a production report on excel. It shows the details for our clients. Part of that data includes the state in which the client lives. We are trying to create a chart showing the percentages of each state( so we know where the most deals are closed) Any suggestions? Hello mr_merchant_man, this sounds like a job for a pivot table, using Average as the data calculation operator. Or, depending on your version of Excel, you can use AVERAGEIFS (in Excel 2007) or calculate an averate with a combination of SUMIF divided by COUNTIF. To be more specific, it would help to s...

Change Source Campaign on Invoice and Order
I need to change the Source Campaign on an Invoice and an Order but the field is locked. I tried to enable the field on the form but still cannot make changes. Any ideas beyond direct edit of DB? ...

Excel 2000/Change Default Opening Location?
I'm using Excel 2000. When I open Excel, and the click on the Open button to open worksheet, it goes to a default location I'd like to change. How can I change that default location? I have searched under Tools > Options, but find no means there. Thanks. -- ---------- CWLee Former slayer of dragons; practice now limited to sacred cows. Believing we should hire for quality, not quotas, and promote for performance, not preferences. Tools|Options|General Tab change the entry in the Default File Location box CWLee wrote: > > I'm using Excel 2000. When I open...

need help Combo Box with duplicate entry.
I have a combo box with unique and non-unique entries. (search field) 00010 | john | smith | 12345 | 00002 00196 | jane | doe | 0120 | 00001 00196 | Jone| wood| 0220 | 00005 I would like the following to happen. 1) user types the number needed ( 10 ) 2) the combo box zero fills the field (00010) 3) then selects an entry from the combo box. (12345) if the select is incorrect ( one of the non-unique numbers was selected - 00196) the user will open the combo box and select the correct entry. (jone wood) add the info will be put on the form. the following code works if the user ente...

POP server always changes to localhost
Hello, My outlook is having a wierd issue. I have three POP3 accounts set up to check email in Outlook. After some point in time, all three will stop functioning because in the E-mail accounts settings dialog my incoming mail server will get changed to localhost, and it fails to log in to box to pull my mail. It appends the POP3 server name to my user name which seems odd. So, to summarize, my Incoming mail server (POP3) field changes from it's usual value (something like mail.server.com) to localhost, and my mail server gets appended to my user name (something like username...

Change bars color
Hello, I have a dinamic chart to show the cash flow position, a scrool bar chagne the data to the past and to the future (estimate), what I am looking for is, to have an easy identification of the estimated period I would like to chage the color of the bar. I am using an Stacked Column chart with two variables. any Ideias? -- regards from Brazil Thanks in advance for your feedback. Marcelo What I usually do when I want to show a column chart with one color within a certain range and another color elsewhere, is create two series, one each color, and use formulas to change on series ...

Sync Money 2004 with TWO iPaqs?
My wife and I just upgraded (?) from the Palm world to HP iPAQ 5555s. On our Palms we were BOTH able to carry a copy of our Money 2003 checkbook around and keep them synchronized to the desktop Money database using a great product from Ultrasoft. That system allowed two Palms to be using money and stay synced to the desktop. Just a normal hotsync was all that it took to update changes to the Money software. Now that we're in the world of Pocket PCs, I've found that Microsoft doesn't have support for syncing to more than one Pocket PC with it's conduit. We upgraded to Mone...

Fill color in autoshape based on cell data
Dear Experts I have a range of cells with an autoshape in each cell. I would like to have the fill color of the autoshape change based on the results of an if statement in each cell. The if statment would return "G", "R", & "Y". The fill colors would be green, red, and yellow. I don't want conditional formatting for the cell fill color, only conditional formatting for the shape I was thinking a select case macro, but can't seem to get the code correct. However, I am a novice at macros Thanks for any assistance Jodi You could use the worksheet ...

How do I convert a two-part, black logo into two separate colors..
I have created a flyer/mailer for my small business. My company's logo are the two block letters 'C' (gold) and 'G' (Blue). I have the graphic saved in my clip arts. Up to now, I can only convert both letters to either all gold or all navy, but not two the two separate colors on the same page. Can anyone help! ReBell in Ms Hey Rebell, From what I've discovered (if the logo isn't too complicated), highlight your 'placed' logo, go to the 'Arrange' tab at the top of the screen and 'Ungroup' the logo. Once it's ungrouped, you shou...

centering text box in a table cell
Trying to do a project. I am attempting to center a text box in a row of a particular table. If I put it inline, I can kind of get it centered, but, it stays to the left side in the cell, doing about 32 of them, and they are all the same, tried adjusting, but must be doing something wrong. Select the text box, click on the dog icon on the picture toolbar, click none. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com http://officebeta.iponet.net/en-us/publisher/FX100649111033.aspx "Bruce" <notreally@idontwantoo.com> w...

Auditing form on record change
HI, I have a form with multiple fields that I want to track changes to. I was able to create a auditing trail when users click on particular buttons however if they dont click on the buttons the auditing does not occur. What I am wanting to do is to run the audit when a user changes to a new record. I have tried the "on current" and "before update" but they didnt work. Any suggestions? Take a look at what Allen Browne has at http://www.allenbrowne.com/AppAudit.html -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "...

Opens to Personel Folder by default...How to Change?
I cant seem to find a setting anywhere that will let me change Outlook 2003 to open right up to the Inbox. It keeps going to the Personel Folder....Even right after a clean install....Anyone I know that uses Outlook never had to set anything and it always went straight to the Inbox. Any one know how to change this?? THANKS! Darren, Outlook toolbar: Tools/Options/Further/extended options/Folder with program start Do you search this setting? -- Oliver Vukovics Outlook Network without exchange: Public OutLook Share your Outlook PST with several users! http://www.outlookstore.com &...

How can I change order of pages in a fold brochure in publisher
When I work on the pages on the screen it shows pages 2 & 3 and the page preview shows 2 & 3 but when I go to print page 3 comes out as page 5. Is your publication setup as a booklet? When you go to print are you checking current page or typing the page number? What version Publisher are you using? "JudieM" wrote: > When I work on the pages on the screen it shows pages 2 & 3 and the page > preview shows 2 & 3 but when I go to print page 3 comes out as page 5. "Mary Sauer" wrote: > Is your publication setup as a booklet? When you go to prin...