473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Using a Combo Box in a Query

I created a query to list all products with a null value in the action field, but I want to be able to update the action field, and I can't. The query results appear in a form. The action field is filled with a combo box. The drop down list appears, but when I click on a selection, nothing happens. It won't accept the data. Maybe I've structured this the wrong way. Any suggestions.
Jul 27 '07 #1
5 2050
puppydogbuddy
1,923 Expert 1GB
I created a query to list all products with a null value in the action field, but I want to be able to update the action field, and I can't. The query results appear in a form. The action field is filled with a combo box. The drop down list appears, but when I click on a selection, nothing happens. It won't accept the data. Maybe I've structured this the wrong way. Any suggestions.
Do you have an AfterUpdate event for your combo box like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCombo_AfterUpdate()
  2.      Me!Action.Value = Me!YourCombo.Column(1)
  3.      Me.YourCombo.Requery
  4. End Sub
  5.  
The above assumes your combo has 2 columns>>>>a hidden bound column, and the action column. Access starts column indexing at 0, so column 1 is the second column.
Jul 27 '07 #2
I checked the properties of my combo box, and I do not have an AfterUpdate event. My combo box does have two columns, and one is hidden, but I will need more help understanding the event you wrote for me. I pasted it into the Code Builder and changed

YourCombo to
Combo33

But it still doesn't work. My guess is that I should probably be changing Me to something as well, but I can't guess what. Thanks for your help, I think we're getting closer.
Jul 27 '07 #3
puppydogbuddy
1,923 Expert 1GB
I checked the properties of my combo box, and I do not have an AfterUpdate event. My combo box does have two columns, and one is hidden, but I will need more help understanding the event you wrote for me. I pasted it into the Code Builder and changed

YourCombo to
Combo33

But it still doesn't work. My guess is that I should probably be changing Me to something as well, but I can't guess what. Thanks for your help, I think we're getting closer.
The after update event code for your combobox fires after you have made a selection from the combobox, and does whatever you code it to do....which in your case....is update the textbox with the selection made from the combo.

1. every combobox can have an after update event procedure if you choose to code it. Place your form in design view, highlight your combo, invoke the property sheet, and click the event tab...the after update event is the second event on the property sheet.
2. Me is correct as long as your combo, your textbox and after update procedure are firing from your main form, and not a subform.
3. combo33 sounds right if you are using the name generated by Access, but you should rename it in accordance with naming conventions to make it clearer to understand in code ....for example, cboAction.
4. if the name of your textbox that you want updated from your selection in the combobox is not Action, then you need to change to the actual name of your textbox.
Jul 27 '07 #4
I rebuilt the combo box and named it as you suggested and it's working, but there's another problem.

The form is built on a query that lists all the products for which the action was quarantine. I want to use the combo box to update the action to recall or release or correction. I can do that now.

The odd thing is that although the correct products are appearing in the form, they appear to have a null value in the action field. They really do have quarantine in that field, but nothing is dispayed in that field.

Maybe its because I'm not really showing that field in my form. I'm actually showing the combo box. That would make some kind of sense. The database will still work properly the way it is, its just a little disconcerting for users who think they are opening a form with a list of products in quarantine and then the form appears to contain a list of products with no actions.

I really appriciate all your help, do you have a suggestion for this problem?
Jul 28 '07 #5
puppydogbuddy
1,923 Expert 1GB
I rebuilt the combo box and named it as you suggested and it's working, but there's another problem.

The form is built on a query that lists all the products for which the action was quarantine. I want to use the combo box to update the action to recall or release or correction. I can do that now.

The odd thing is that although the correct products are appearing in the form, they appear to have a null value in the action field. They really do have quarantine in that field, but nothing is dispayed in that field.

Maybe its because I'm not really showing that field in my form. I'm actually showing the combo box. That would make some kind of sense. The database will still work properly the way it is, its just a little disconcerting for users who think they are opening a form with a list of products in quarantine and then the form appears to contain a list of products with no actions.

I really appriciate all your help, do you have a suggestion for this problem?
I thought that the textbox on your form was where the Action selected in your combobox was being displayed as a result of the AfterUpdate event code I gave you. So I don't understand what you mean by this:
<<<<Maybe its because I'm not really showing that field in my form. I'm actually showing the combo box. >>>
1. Is the textbox visible?
2. Is the column width of the two columns in the combobox set properly. The column width of the action column of the combobox should be set wide enough so that it can be seen in the combobox.
3. Is the Action column of the combo box the second column from the left, which is column #1 (column numbers start with 0)
4. Why are you binding the form to a query that limits the results only to quarantined items...is that what you want? If you want to see all products, quarantined or not... your query record source for your would look something like this (keep in mind that I don't know your actual field names, so I am using illustrative names:

Select Product, Action From tblProduct

Please clarify. Thanks.
Jul 28 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Skully Matjas | last post by:
I am using the following code (created by the wizard) to allow to bring my form to a particular entery. But when I edit the entery (ex: put new information into a blank cell), it puts that record...
5
by: Dalan | last post by:
I have been searching the archives in an effort to discover how to derive a dual use of a single combo box - so far no go. I found the piece below which pretty much represents the usage. To...
3
by: pelcovits | last post by:
I am trying to set up an unbound form to enter report criteria. I've followed the MS Office Assistance document: "Create a form to enter report criteria" which describes how to enter data (such...
0
by: Andrew | last post by:
Hello, I am trying to create a chart whose underlying query is linked to 2 combo boxes on the same form. I want to pass the values from the combo boxes into the chart query to allow the chart...
4
by: meganrobertson22 | last post by:
Hi Everyone- I have a question about how to add and then use the "All" selection in a combo box. I am trying to figure out how to: (1) add "All" as a selection to a combo box and then (2)...
3
by: hmiller | last post by:
Hey everyone, I am having a hell of a time trying to set this menu system up. Here's what I'm trying to do. Combo Box One; is populated by names under properties "row source" "Phase 1"...
2
by: visionstate | last post by:
Hi there, I am working on a form that uses 3 text boxes and 3 combo boxes. When any data is entered into any of these, I click a command button and this requeries a sub query in the form and...
3
by: fstenoughsnoopy | last post by:
Ok the complete story. I have a Contact Table, Query and Form, that are used to input and store the contact info for customers. They have FirstName, LastName and Address as the primary key...
6
by: fieldja | last post by:
I have a form called OwnerForm. It contains a combo box called Owner. The combo box looks up names from a table called OwnerName. It contains fields called OwnerID and Owner. I also have a main...
1
by: lawton | last post by:
Source: this is an access 2003 question My knowledge level: reading books, internet, and trial & error; no formal training I'm trying to get a running sum of what's filtered in a subform which is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.