Requery Combo Box

Not sure if I am doing this correctly or not.  I have a form that has 
several combo boxes on it that allow a user to pick a name from a list.  I 
need to have the next combo box be requeried and not include the selection 
from the first box.  This has to continue until four boxes have been 
selected.

The table, tblDesignators, have the data that is in the combo box.  For an 
example, it contains the names of people.

The user selects a name from the first combo box that has a query behind it 
to select all the names.  After the selection, the user moves onto the next 
box and selects a new name.  I don't want the name from the first selection 
to appear in the box.  I almost had it by using a query that had something 
like this in the criteria of the query:

<>Forms!frmApprovalList!ComboBox1.

This did work for the second combo box.

The third combo box I tried the criteria as

<>Forms!frmApprovalList!ComboBox1 AND <>Forms!frmApprovalList!ComboBox2.

The selection ended up with no records.  I tried an OR as well and still no 
results.

If someone decides to go back and change names, the first box has to be 
requeried and start again.

Make sense? 


0
Chuck
6/8/2007 8:50:03 PM
access.queries 6343 articles. 1 followers. Follow

3 Replies
574 Views

Similar Articles

[PageSpeed] 27

You'll need to repeat the column name in the criterion for the second combo 
box:

<>Forms!frmApprovalList!ComboBox1 AND [Designator] 
<>Forms!frmApprovalList!ComboBox2

You can do it in SQL view or all in one column as a single entry in the 
criteria row in query design view, or you can add the Designator column to 
the design grid twice, unchecking the 'show' check box for the second 
instance.  On the same criteria row for each column add the restrictions 
separately in each, i.e. <>Forms!frmApprovalList!ComboBox1 for one and 
<>Forms!frmApprovalList!ComboBox2 for the other.  Access will then insert the 
AND operator in the SQL statement for you.

Ken Sheridan
Stafford, England

"Chuck" wrote:

> Not sure if I am doing this correctly or not.  I have a form that has 
> several combo boxes on it that allow a user to pick a name from a list.  I 
> need to have the next combo box be requeried and not include the selection 
> from the first box.  This has to continue until four boxes have been 
> selected.
> 
> The table, tblDesignators, have the data that is in the combo box.  For an 
> example, it contains the names of people.
> 
> The user selects a name from the first combo box that has a query behind it 
> to select all the names.  After the selection, the user moves onto the next 
> box and selects a new name.  I don't want the name from the first selection 
> to appear in the box.  I almost had it by using a query that had something 
> like this in the criteria of the query:
> 
> <>Forms!frmApprovalList!ComboBox1.
> 
> This did work for the second combo box.
> 
> The third combo box I tried the criteria as
> 
> <>Forms!frmApprovalList!ComboBox1 AND <>Forms!frmApprovalList!ComboBox2.
> 
> The selection ended up with no records.  I tried an OR as well and still no 
> results.
> 
> If someone decides to go back and change names, the first box has to be 
> requeried and start again.
> 
> Make sense? 
> 
> 
> 

0
Utf
6/8/2007 9:41:01 PM
Thanks Ken, I tried that and the results were an empty box.
The SQL was generated like you said, but produced no results.

"Ken Sheridan" <KenSheridan@discussions.microsoft.com> wrote in message 
news:447E7B26-4E54-4749-93BE-7FE3DF1ABEE6@microsoft.com...
> You'll need to repeat the column name in the criterion for the second 
> combo
> box:
>
> <>Forms!frmApprovalList!ComboBox1 AND [Designator]
> <>Forms!frmApprovalList!ComboBox2
>
> You can do it in SQL view or all in one column as a single entry in the
> criteria row in query design view, or you can add the Designator column to
> the design grid twice, unchecking the 'show' check box for the second
> instance.  On the same criteria row for each column add the restrictions
> separately in each, i.e. <>Forms!frmApprovalList!ComboBox1 for one and
> <>Forms!frmApprovalList!ComboBox2 for the other.  Access will then insert 
> the
> AND operator in the SQL statement for you.
>
> Ken Sheridan
> Stafford, England
>
> "Chuck" wrote:
>
>> Not sure if I am doing this correctly or not.  I have a form that has
>> several combo boxes on it that allow a user to pick a name from a list. 
>> I
>> need to have the next combo box be requeried and not include the 
>> selection
>> from the first box.  This has to continue until four boxes have been
>> selected.
>>
>> The table, tblDesignators, have the data that is in the combo box.  For 
>> an
>> example, it contains the names of people.
>>
>> The user selects a name from the first combo box that has a query behind 
>> it
>> to select all the names.  After the selection, the user moves onto the 
>> next
>> box and selects a new name.  I don't want the name from the first 
>> selection
>> to appear in the box.  I almost had it by using a query that had 
>> something
>> like this in the criteria of the query:
>>
>> <>Forms!frmApprovalList!ComboBox1.
>>
>> This did work for the second combo box.
>>
>> The third combo box I tried the criteria as
>>
>> <>Forms!frmApprovalList!ComboBox1 AND <>Forms!frmApprovalList!ComboBox2.
>>
>> The selection ended up with no records.  I tried an OR as well and still 
>> no
>> results.
>>
>> If someone decides to go back and change names, the first box has to be
>> requeried and start again.
>>
>> Make sense?
>>
>>
>>
> 


0
Chuck
6/11/2007 11:57:33 PM
The lists for the second and third combo boxes will be empty until, in the 
case of the second, a selection has been made from the first and the second 
requeried, and in the case of the third, a selection has been made from the 
second and the third requeried.  This is because the controls are Null until 
a selection I made and any comparison with Null results in Null, so the WHERE 
clauses of the two RowSource queries will not evaluate to True for any row.  
Once a selection has been made and the next combo box down the line requeried 
then its list should be populated.

Ken Sheridan
Stafford, England

"Chuck" wrote:

> Thanks Ken, I tried that and the results were an empty box.
> The SQL was generated like you said, but produced no results.
> 
> "Ken Sheridan" <KenSheridan@discussions.microsoft.com> wrote in message 
> news:447E7B26-4E54-4749-93BE-7FE3DF1ABEE6@microsoft.com...
> > You'll need to repeat the column name in the criterion for the second 
> > combo
> > box:
> >
> > <>Forms!frmApprovalList!ComboBox1 AND [Designator]
> > <>Forms!frmApprovalList!ComboBox2
> >
> > You can do it in SQL view or all in one column as a single entry in the
> > criteria row in query design view, or you can add the Designator column to
> > the design grid twice, unchecking the 'show' check box for the second
> > instance.  On the same criteria row for each column add the restrictions
> > separately in each, i.e. <>Forms!frmApprovalList!ComboBox1 for one and
> > <>Forms!frmApprovalList!ComboBox2 for the other.  Access will then insert 
> > the
> > AND operator in the SQL statement for you.
> >
> > Ken Sheridan
> > Stafford, England
> >
> > "Chuck" wrote:
> >
> >> Not sure if I am doing this correctly or not.  I have a form that has
> >> several combo boxes on it that allow a user to pick a name from a list. 
> >> I
> >> need to have the next combo box be requeried and not include the 
> >> selection
> >> from the first box.  This has to continue until four boxes have been
> >> selected.
> >>
> >> The table, tblDesignators, have the data that is in the combo box.  For 
> >> an
> >> example, it contains the names of people.
> >>
> >> The user selects a name from the first combo box that has a query behind 
> >> it
> >> to select all the names.  After the selection, the user moves onto the 
> >> next
> >> box and selects a new name.  I don't want the name from the first 
> >> selection
> >> to appear in the box.  I almost had it by using a query that had 
> >> something
> >> like this in the criteria of the query:
> >>
> >> <>Forms!frmApprovalList!ComboBox1.
> >>
> >> This did work for the second combo box.
> >>
> >> The third combo box I tried the criteria as
> >>
> >> <>Forms!frmApprovalList!ComboBox1 AND <>Forms!frmApprovalList!ComboBox2.
> >>
> >> The selection ended up with no records.  I tried an OR as well and still 
> >> no
> >> results.
> >>
> >> If someone decides to go back and change names, the first box has to be
> >> requeried and start again.
> >>
> >> Make sense?
> >>
> >>
> >>
> > 
> 
> 
> 

0
Utf
6/12/2007 10:03:01 AM
Reply:

Similar Artilces:

Combo box to find records
Hi, need help with what I am sure is a simple problem. I have a form and wish to find records using a combo box. Which I know how to do. The problem is it takes me to "one" record. I would like to select, for example, employee name: John Smith and it return all records for John Smith while filtering out all other records. I would be thankful for any help. Thanks, Michael On Wed, 30 Jan 2008 20:24:04 -0800, Michaelchessking <Michaelchessking@discussions.microsoft.com> wrote: >Hi, need help with what I am sure is a simple problem. > >I have a form and wis...

CScrollBar box flicker problem
I put CScrollBar in CDialog and thumb button flickering all the time. Somone can help me? Tnx ...

Excel should allow auto shape boxes to be fixed to points on the g
I have constructed a graph that has data added to it daily. On the graph I have used several auto shape boxes to highlight key data milestones. Problem is every time I add new data the auto shape boxes move and have to be manually adjusted to repoint them to the relevant data point. Is there any way they can be fixed to the relevant data points on the graph so that they remain fixed to that point and therefore don't move/shift when new data is added? ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for ...

How do to enter data in a combo box on a worksheet?
Use the dropdown arrow? Shereen wrote: -- Dave Peterson ...

Disable 'Macro' dialog box...
Thanks Geoff, for the info on how to protect the VBA code. Have one further question; Now that the workbook and code is protected, I have sub routines that are run from command buttons. However, it is still possible to push ALT-F8 to list my routines, then click on a routine, then choose 'Run'... Is there a way to disable this option, so that users can not view or run the list of available routines (I need them to run the routines, only from the command buttons). Ruskin You can do what you want by making each macro a Private macro. This will preclude that macro from appearing...

Combo Box Moves
I have 4 activeX control combo boxes on an Excel sheet (2 on the left and 2 in the middle) and if I print the sheet the 2 boxes thatbare in the middle move over to the left hand side. I have gone into the properties menu and they show as locked but it does not make any difference. Also when I print the sheet the 2 boxes on the left which were made the same size as the underlying cells print out smaller than the underlying cells. Can anyone help please? Hi John, See MSKB Article # 838910 (Controls move to the left of the worksheet in Microsoft Excel 2002) http://support.micr...

After Add Record, Put Cursor in specific Text Box
Hi, I had the wizard set up a button to add record (it puts in the code below in the On Click property of the button). I'd then like to have the focus go to text box [ProjectType]. I don't know how to do that. TIA :) Private Sub cmdAddRecord_Click() On Error GoTo Err_cmdAddRecord_Click DoCmd.GoToRecord , , acNewRec Exit_cmdAddRecord_Click: Exit Sub Err_cmdAddRecord_Click: MsgBox Err.Description Resume Exit_cmdAddRecord_Click End Sub Private Sub cmdAddRecord_Click() On Error GoTo Err_cmdAddRecord_Click If Me.Dirty Then Me.Dirty = False If ...

Public Function to display in text box
Have public function (loaded in the global module) that produces a variable as a double. That all works fine as evidenced by the debug.print method in the immediate window. I desire to have the current value of the variable displayed in a text box. I created a callback function (loaded in global module) that looks like: Public Function GetCurrentWork_GPCI() As Double Dim CurrentWork_GPCI As Double GetCurrentWork_GPCI = CurrentWork_GPCI End Function I can't figure out how to make it display; I've currently got the control source property ...

Check Box Sizing
Hi, When using check boxes, no matter how much I resize the area, the actual check box itself never gets larger (only the area for a description does). Is there any way to increase the size of the check box so that a larger check mark appears on the worksheet? Thanks, Brad. Brad, If you select "move and size with cell" (on the properties tab) then you can resize the checkbox by increasing the column width and/or row height. Give my regards to Boston. HTH, Bernie MS Excel MVP "beantownbrad" <beantownbrad@discussions.microsoft.com> wrote in message news:C63B5725-...

Text Box Updating
I am having trouble getting a text box to auto fill from a choice made from a combo box. Combo Box Name is Address_21 Text Box Name is City_1 My code is as follows: 'Auto Fill CES Spec Written Office Private Sub Address_21_Change() Select Case Address_21 Case ""2306 Long Green Court" City_1 = "Valrico" Case ""3440 Oakcliff Road" City_1 = "Atlanta" Case "7015 East 14th Aveneue" City_1 = "Tampa" Case "1800 Taylor Drive" City_1...

Programatically creating text box
Hi all..I need help regarding creating the edit box programatically.. I have drawn a movable rectangle in a view.Now how i want to make that rectangle editable..can any body show me some pointer/sample code? I was cocoa programmer. i know how to do this in mac os..but i dont know how do i o it in MFC.. please help me I took the source code for drawing from following link : http://www.codeproject.com/miscctrl/diagrameditor.asp Thanks in advance CEdit editbox; when you need it editbox.Create(...parameters here...) and when you are done with it, editbox.DestroyWindow(); or if you want ...

Multiple selection list box...
I have a multiple selection listbox on a dialog box. When the user picks the listbox items and clicks "OK" my program draws to the main screen. If the user reopens the previous dialog box, I want the previously chosen listbox choices to be highlighted. How would I do this? Thanks, RABMissouri Store the selection in a common place like the Document or MainFrame or the App and do the selection in the OnInitDialog() member function of your dialog. -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- "RBert" <drbert@microcore.net> wrote in m...

Populating a field using a pull-down/combo box menu
Hello all, I'm working on MS Excel. I am trying to find the source code for something that will allow me to do the following novel procedure with a pull-down menu and a text box: There is a pull-down menu, and another text box right besides the pull-down menu. The pull-down menu has the names of all the states in the USA in it. When one state is selected, the text box is automatically populated with the capital of that state. In MS Excel, I've created a novel way to handle this issue using Boolean logic. Unfortunately, I can only have 7 states in my pull-down menu, and the sour...

folder dialog box
hi; i am learning mfc and i want to make gui application that user selects a directory and app writes all the file names in this directory to a file recursively. i am not sure where to start can anybody help me where should i start? thanks;) Have a look at BrowseForFolder()" API and 'CFileFind' class members. Have a look at http://www.codeproject.com/cpp/BrowseForFolder.asp for help with some sample code. -Seetharam Seetharam wrote: > Have a look at BrowseForFolder()" API and 'CFileFind' class members. That's SHBrowseForFolder(). -- David Wilkinson ...

formulas from a drop down box
I was wondering if it is possible to have a list of formulas in a drop down box so that when I pick a formula, that is the one that is applied to that cell. Any help would be great. Lisa, The following uses a Combobox from the forms toolbar. It assumes that Combobox has been assigned a single column list range where the formulas are shown. The first item in that list should be a title, such as "Formulas", while the rest of the list should be the actual formulas without the leading equal sign "=". The linked cell for the combobox must also have been assigned. '----...

MDIChild like window from Dialog box
Hello, In a windows application, I have a dialog box that pops up on selecting a menu item. The Dlg has a button upon pressing which, I need to see a MDI like frame. How can I achieve it?? Thx John S ...

showing a dropdown list dependent on what's selected in the previos drop down box?
In Column 1 I have a drop down box with all of the makes of vehicle (Chevy, ford, dodge, etc...). In Column 2 I have a place to type i the model. I want to make a dropdown box in Column 2 that will show me all of th available models for a particular brand. (If Chevy is selected i Column1, then only Chevy models will be displayed in the dropdown bo next to it.) Like they use on web pages like kelleybluebook.com an cars.com. thanks -- lhernd ----------------------------------------------------------------------- lherndo's Profile: http://www.excelforum.com/member.php?action=getinfo&am...

why will pandora's box not work on windows xp
why will pandoras box not work on windows xp because it requires a 16 bit operating system and XP is 32-bit operating system "bill" wrote: > why will pandoras box not work on windows xp ...

Text box default value
I wish to establish a new default value for a text box - based on what the user entered. How I do that in VBA? <identification of default default value entry> = <whatever the user entered> I can handle the second part, but.... "news2@rgcle.com" <news2@rgcle.com> wrote in message <L62dnWMjTYBXj7zbnZ2dnUVZ_s2vnZ2d@comcast.com>: > I wish to establish a new default value for a text box - based on > what the user entered. How I do that in VBA? > > <identification of default default value entry> = <whatever the user > entered> > &g...

3 linked combo boxes in a form
I need some assistance with a form in Access. I have a combo box based on a Shop table. It is followed by a combo box based on an Area table. The areas are unique to each shop. I have created an SQL query that makes it so when a certain shop is selected in the first (Shop) combo box, only the areas unique to that shop are selectable from the Area combo box. I have also added a macro to requery the Shop combo box to update the Area selectable items. Now here is my problem. I have a third combo box for Equipment that is based on an equipment table listing over 900 pieces of equipment specif...

find replace cursor default to find box
When using replace in Excel, after the first usage, the cursor defaults to showing in the replace box. This is different to previous versions of Excel and to other office applications including the VBA editor. I'd like it so the cursor always defaulted to the find box. ...

Creating notches in box whisker plots in Microsoft Excel
Does anyone know how to create the notches in the vertical box whisker charts? An example can be found in figure 10 of the following article: http://www.qualitydigest.com/oct97/html/excel.html Thank you!! Hi, The technique describes how to use an xy-scatter to construct the boxes. You need to add a few more xy pairs in order to reduce the width of the Median line and form the notches. Cheers Andy br7250@gmail.com wrote: > Does anyone know how to create the notches in the vertical box whisker > charts? > > An example can be found in figure 10 of the following article: >...

Using Combo Box to Auto Fill Data
I have a form set up with a sub form in it. I want to have a drop down box auto fill the fields on the main part of the entry window where the information is not changable. The only part of the combo box that comes up does not allow me to take information from the data I am working on. How do I get it to do this with a subform in the form? I can get it to work on a basic form with no subform but this isn't working. I have tried separating the forms and it still doesn't work. Please email me at my work email linda.l.neils@census.gov. I am really in need of getting t...

Lost Focus
How can I do a requery or error message "change to new sceen", when a user queries one sku number. Then queries another without changing record pages in a form. For example, if they key in the first sku number 12345 & all of the fields are populated, then 23456 & the null fields do not requery. Capturing the data from the previous sku number. We have asked that they change to a new record screen, but sometimes forget. I have included the LostFocus code below. Private Sub Code_LostFocus() Dim rst As Recordset Dim db As Database Dim dblIte...

My Name is Not In the To Box Criteria
Can someone tell me what the definition of "my name" is in the rule criteria "my name in not in the to box". Is this based on the email account name field? What happens if you have multiple accounts created? ...