OnChange combo box

I am using the On Change event to peform actions when the value selected in a 
Combo box changes. However, if i select the value in the list which is the 
same as the current value for the combo box the On Change event still sees 
this as a change. How do i prevent this so that the On Change event only 
occurs if the value selected in the list is different from the current combo 
box value?
0
Utf
11/18/2009 7:43:02 PM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
1052 Views

Similar Articles

[PageSpeed] 38

Confused Slug wrote:

>I am using the On Change event to peform actions when the value selected in a 
>Combo box changes. However, if i select the value in the list which is the 
>same as the current value for the combo box the On Change event still sees 
>this as a change. How do i prevent this so that the On Change event only 
>occurs if the value selected in the list is different from the current combo 
>box value?

Do not use the Change event for this.  It fires for every
keystroke typed into the combo box's text portion.  As your
question indicates, it doesn't provide the facilities to do
what you want either.  Instead, you should perform your
actions in the combo box's AfterUpdate event.

If the combo box is bound to a record source field, you can
check the value against the combo box's OldValue property:

	If Me.combobox <> Me.combobox.OldValue Then
		'do your actions here
	End If

-- 
Marsh
MVP [MS Access]
0
Marshall
11/18/2009 8:05:20 PM
Thanks for pointing me in the right direction, all sorted

"Marshall Barton" wrote:

> Confused Slug wrote:
> 
> >I am using the On Change event to peform actions when the value selected in a 
> >Combo box changes. However, if i select the value in the list which is the 
> >same as the current value for the combo box the On Change event still sees 
> >this as a change. How do i prevent this so that the On Change event only 
> >occurs if the value selected in the list is different from the current combo 
> >box value?
> 
> Do not use the Change event for this.  It fires for every
> keystroke typed into the combo box's text portion.  As your
> question indicates, it doesn't provide the facilities to do
> what you want either.  Instead, you should perform your
> actions in the combo box's AfterUpdate event.
> 
> If the combo box is bound to a record source field, you can
> check the value against the combo box's OldValue property:
> 
> 	If Me.combobox <> Me.combobox.OldValue Then
> 		'do your actions here
> 	End If
> 
> -- 
> Marsh
> MVP [MS Access]
> .
> 
0
Utf
11/18/2009 9:55:02 PM
Reply:

Similar Artilces:

Change check box size and fount size?
How do I enlarge the font and check box sizes found in the forms toolbar? When I paste them in my spreadsheets they are way to small to read. In Excel 200 you could highlight them and change the size with formatting. These boxes are greyed out in Excel 2003 You sure you're not recalling checkboxes from the control toolbox toolbar? George Morris wrote: > > How do I enlarge the font and check box sizes found in the forms toolbar? > When I paste them in my spreadsheets they are way to small to read. In Excel > 200 you could highlight them and change the size with forma...

How to remove attached files from messages in the box ?
Hi, I would like to delete attached files from messages in my inbox, preserving the rest of the messages. With Outlook Express, I could do this using th utility "OE Quick Tool". How is it possible with Outlook 2002 ? Fred "Fred Hazel" said in news:%234jMmPr0DHA.3220@tk2msftngp13.phx.gbl: > Hi, > > I would like to delete attached files from messages in my inbox, > preserving the rest of the messages. With Outlook Express, I could do > this using th utility "OE Quick Tool". How is it possible with > Outlook 2002 ? > > Fred I think you ha...

Is it possible to use the OnChange event for 'on-form' actions?
Hi, I have the following question. Would it be possible to have a picklist item called 'topic' on the case form with let's say four values, 1. test1. 2.test2. etc. Depending on the value selected in this picklist, we would like the users to fill in certain fields on the case form and leave the other fields blank. I am aware of the OnChange event, but my technical skills are letting me down a bit. What is the main purpose of using the OnChange event. Could we for instance add in some code that will make certain fields on the form business required depending on the chosen v...

Using onchange method in a pick list
Hi, I have 2 pick lists, the values of the second pick list depend on the selected value of the first pick list. For example, I have countries in the first one and Cities in the second one. I would like to change the values of the second pick list, depending on the country selected. Is it possible to do it? I really apreciate any help!!!! Thank you all in advance. Dear Katy, The following is not possible. The only way to do it is to use ISV Button to perfom Area Sectorization. This would be feasible with moderate programming skills. If you have advanced area sectorizatiom requ...

onchange with lookup fields
Hi people, I'm trying to create a script using onchange() which would copy one lookup1 field to another lookup2 field. When I'm writing crmform.lookup2name.value = crmform.lookup1name.value nothing happens. But if I'm adding a string "alert(crmform.lookup2name.value)" then I receive ID for lookup1. So, I think mapping between fields has done. But in the web form lookup2 field does not populate. Is somebody know solution? -- Best regards, Alexander Baskakov Hi, how is your exact syntax? crmForm.CFPsomething.value == "somethingmore" Did you use 2 =? Reg...

Text Box Linked To Cell
My goal is to have a text box that displays the contents of a particular cell. How do I link the text box to the cell? Thanks, Denise Hi denise, Make a Text Box from the drawing toolbar. Select the box and in the Formula Bar, type = and then select the cell, press enter. ( IE: =$C$5 ) The cell can also be on a different sheet, just do the same. ( IE: =Sheet2!C5 ) Dave denise Wrote: > My goal is to have a text box that displays the contents of a > particular > cell. How do I link the text box to the cell? > > Thanks, > Denise -- Piranha --------------------------...

Combo Box sort first by alpha-numeric address sets
I have a Combo box of addresses that look like this: Run_point_Address_A 136 Herne Hill, SE24 26 Stanstead Road, SE23 35 Sunderland Road, SE23 389 Coldharbour Lane, SW9 41 Stanstead Road, SE23 Blythe Hill, SE6 Brockley Rise, SE23 Brockley Rise, SE23 Coldharbour Lane, SE24 Half Moon Lane, SE24 Herne Hill, SE24 Herne Hill, SE24 Milkwood Road, SE24 Milkwood Road, SE24 Milkwood Road, SE24 Stanstead Road, SE23 Stanstead Road, SE23 Stanstead Road, SE6 How can I make it sort like this: (Which is Alpha first, then numerical, but based on the individual alpha address sets) Run_point_Address_A Bl...

Combo Box 12-17-07
I have a table with among other fields, Provider Name, Tax ID Number. How do I get the tax ID number to auto populate in the tax ID field when I select the Provider Name? Thanks. Assuming the Tax ID is a feild in the table with the Provider name, you could add a column to carry the Tax ID Number in the column. Then, wherever you move to a new record, populate the control bound to the Tax ID Number field using the combo's column collection. -- Dave Hargis, Microsoft Access MVP "Joe" wrote: > I have a table with among other fields, Provider Name, Tax ID Number. How ...

Combo filter
Hi all, Imagine this CONFIG r1 r2 r3 r4 COL 11 200 NA NA 400 22 NA NA NA NA 33 NA NA NA NA 44 500 400 500 900 This is the way my data is presented. I have a list of around 40 part and each part has this price structure attached. "Config" is col F- and "COL" 11-44 exists for each part. Total of around 300 rows. F-I an all rows is range called "PRICING" What im trying to achieve is to have a user form on opening with 2 combo boxes "CONFIG...

how to change the color of dialog box and its controls
hi, Using appwizard I have created a dilog base application in that i want to change the color of dialog and control buttons and edit controls etc. how to change the color of dialog box and its controls. pls help me urgently. shiva > how to change the color of dialog box and its controls. overwrite OnCtlColor for your dialog and set the text and background color according to the control that is about to be drawn. my program is like this HBRUSH CNeuralDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColo...

Need help cascading 5 combo boxes
I’m working with Access 2007. I have a form with two groups of cascading combo boxes. My first group has two cascading combo boxes, which works. My second group has 5 cascading combo boxes. This second group is giving me trouble. The first 3 combo boxes cascade nicely. But combos 4 & 5 display everything. I don’t know what I’m doing wrong. Everything I’ve seen posted only refers to two combos so I can’t seem to fill in the blanks when working with 5 combo’s. I know I’m missing something. The table name is tblICGDM. The 5 combo boxes are: cboInvestor; cboCompany; cboGr...

Combo box
Greetings, Using the wizzard for creation of combo boxes the third option onm initial options page allows the combo box to find a record on a search. I would like this option but also be able to add to the list to allow new records to be created. How can I do this in vba code/form properties? The wizard had a macro running on the after update, couldnt quite see how to replicate this action using code/form properties. This would clear up my problem with my other long winded and hard to read post !!! Thanks Rob Hi Rob, Not positive this is what you mean, but the combo box will refl...

#error in text box
I have this code in a text box = dsum("[Amount]", "[July 09 - On Billings and Adjustments Data Query]", "[Customer No] = " & [cboCustomerNumber] & " AND Format([Posting Date Period], ""yyyymm"") = '" & Format([cboPostingDate], "yyyymm") & "'") i keep getting #error in my text box i'm struggling to find they answer to why the query July 09 - On Billings and Adjustments Data Query has fields of customer Number posting periood date Amount Now i have two combo ...

List box
first of all thank u in advance.... Hope this is possible I want to use a list box to search a record to show on the reports.. after selecting a record in the list box they can preview the report but I have 2 types of reports that is depend on the selected data.. please see below CompanyName State Layer Company1 NY 1 Company1 DC 1 Company1 PA 2 Company2 NY 1 Company2 DC 1 If user select a company has location in NY and Rank is ...

Script
Script writing isn't my thing, so is there anyone that could tell me what the script would be for: if there are four boxes on a form and one of them is check the others go gray? Sample: if (crmForm.all.[YOUR FIELD].DataValue =3D=3D "SOMETHINGS") { crmForm.all.[YOURFIELD 1].Disabled =3D true; crmForm.all.[YOURFIELD 2].Disabled =3D true; crmForm.all.[YOURFIELD 3].Disabled =3D true; crmForm.all.[YOURFIELD 4].Disabled =3D true; } Darren Liu Crowe Chizek and Company http://www.crowecrm.com On 3=D4=C222=C8=D5, =CF=C2=CE=E712=CA=B122=B7=D6, Elisa <E...@di...

Message Boxes
When displaying a message box how do you insert rows, carriage returns and place bullit points on left hand side of box. I've seen how to do it somewhere and I know it's dead simple but can't remember where!!! Thanx all!!! Mikey, Use the concatenate operator, &, with the Chr(10) (line feed) code: MsgBox "First line" & chr(10) & "Second line" To keep the code cleaner-looking, you may want to use the form: MsgBox "This is the first line" & Chr(10) & _ "This is the second" & Chr(10) & _ "And the fina...

building query with list boxes
Hi All, i built in the past an application that based on several combo box creates query. now after the application was promoted i been requested to change it to be list box. that mean several of items that suppose to be elected in one control. does any one have example of a code that create this option? On my website (www.rogersaccesslibrary.com), is a small Access database sample called "CreateQueries2.mdb" which illustrates how to do this. Look at Form 6. -- --Roger Carlson MS Access MVP Access Database Samples: www.rogersaccesslibrary.com Want answers to your Access...

Need help in list box
Dear Sirs , Could you please explain to me how could I place a question in allenbrowne.com and from where I can view the respond ? Now I have a question and I need your help , it is very urgent please . I am using Microsoft access 2007 and I have a table called =93Type Table=94 it contains tow fields : Typecode and TypeName , so when I have a new type I will add it to this table . I have a second table called =93Etape Table=94 it contains a several field and one of these fields called =93 type code=94 (take the data from the Type Table) I need to create a form to vie...

Storing values selected from a combo
I have created an invoice form that (unsurprisingly) starts with the debtor name, account no, and several address fields. I have a combo that looks up the debtor table and displays several columns to show the names, account nos and full addresses and enable the correct one to be selected. (Hence my earlier post about the alignment of the dropdown list, which you may have seen a little while ago). I can populate the various fields on the form by using =comboboxname.Column(#) as appropriate for each of them, so that the full details of the debtor are then displayed on the "invoice&quo...

Pop Up Combo Box
I have 3 options in a combo: TS, CT, and MISC Each one of these options has their own pertinent account codes. What I want is the ability to choose one of the options (TS, CT or MISC), and based on that choice, have another combo box pop up with a list of corresponding account codes. If you can help with step-by-step moron-proof instructions, I would be much obliged. This is called "cascading combo boxes". A google search should return plenty of links that will show you how to do it. HTH -- _________ Sean Bailey "natalie" wrote: > I have 3 options in a combo...

TEXT BOX HELP
I have office XP on my computer. When using text boxes, my computer locks up. Is there a fix? I have deleted the program and reinstalled and still have the problem Hi Karen (ksutton@edmurdocksuperstores.com), in the Microsoft� newsgroups you posted: || I have office XP on my computer. When using text boxes, || my computer locks up. Is there a fix? I have deleted the || program and reinstalled and still have the problem Microsoft Office Publisher 2003 and older are critical about video drivers. Usually upgrading (or downgrading in some cases) will fix the problems you are encounterin...

Making Lines and design boxes visible on printing in word
Hi I have created a report in access which is like a printable form.It is populated with fields .The form needs to have lines(EX. Name: __________________).I tried to place lines using the toolbox below each of the fields.Also it has a design including color field rectangles.My problem is on printing the document in word there are no lines seen neither are the rectangles.so basically it is a plane page with text.Can you please tell me what is the problem and which is the quickest and right way to achieve this! thanks -- Message posted via http://www.accessmonster.com Prachi via AccessMo...

mfc combo box help
i have a problem with mfc, after choosing something in the combo box the edit box should update and show the text corresponding to the combo box choice, but what happens is when i choose something from the combo box nothing happens im new to mfc and so i need a little help please, heres the code: void CQuakeLaunchDlg::OnCloseupModtorun() { CString modname; //combo box variable m_strmod = modname; if (modname == "ORIGINAL QUAKE") m_cline = "qwcl.exe"; if (modname == "ZQUAKE") m_cline = "zq-client-gl.exe"; if (modname == "TEAM FORT...

Combo box with null value
I have a form whereby the user can click a command button to display a combo box and a select value. My question is if the user has mistakenly clicked the button and tabbed away from the combo without selecting a value, how would I go about resetting the button and its' combobox. That is, the combo goes invisible again and its' button is ready to be clicked again. TIA............. -- Don, Sydney Australia Don, When the button (ex. cmdShowCombo) is clicked, use GoToControl to go to force the user to the combo (ex. cboCombo1). Private Sub cmdShowCombo_Click() cboCombo1....

Macro to pause for user input in dialog box
I have a macro that i want to select a 500 cells, go into the Data Validation menu, and then pause so that the user can input their particular validation parameters and the input message. Then when the use hits OK, I'd like the macro to continue on it's way. Here's what I have, but it just selects the cells and doesnt open the dialog box. Application.Goto Reference:="R1C3:R500C3" With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .IgnoreBlank = True ...