473,383 Members | 1,803 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,383 software developers and data experts.

Combo box in form does not show existing value

Hello

I have a database representing an inventory where objects are classified as normal or containers. Only containers can contain other objects and no object can be contained in more than one container. I use two tables, one listing the objects and the other table listing the relationships between objects and containers (which object is contained in which container).

The second table uses a form in order to add data. The form has a combo box that lists objects that are not contained yet. It uses a query to do that. The query lists all the objects from the first table that are not contained in the second. After adding some data on that table I close the form. The next time I open it, I cannot see the values of the objects in the combo box, although the table contains them.

I guess that the reason why the combo box does now show the values (to answer my own stupid question) is the fact that the query does not return values that are already there. So the question becomes, is there a workaround to circumvent that, when something actually exists in the field or should I add another box that will just display the value of the field of the current record?

Thanks
George

P.S. Pardon the seemingly double post but I didn't realize that two questions don't fit in the same thread.
Apr 19 '13 #1

✓ answered by Seth Schrock

You have accurately diagnosed the problem. There are several ways around this ranging from simple to complex. I'll give you the simple solution. The idea is generally the same for each solution, but the implementation of the idea is where the variety comes in.

What I would do is to have one unbound combo box on your form that has the filter on it and then another combo box on the form that is bound to your field that has no filter in its row source, but have the control Locked. What you can then do is use the following code to move your selection from the unbound control to the bound control:
Expand|Select|Wrap|Line Numbers
  1. Me.BoundControlName = Me.UnboundControlName
You can put this in the unbound control's after_update event or you can create a button that when clicked (on_Click event) will make the copy.

2 7194
Seth Schrock
2,965 Expert 2GB
You have accurately diagnosed the problem. There are several ways around this ranging from simple to complex. I'll give you the simple solution. The idea is generally the same for each solution, but the implementation of the idea is where the variety comes in.

What I would do is to have one unbound combo box on your form that has the filter on it and then another combo box on the form that is bound to your field that has no filter in its row source, but have the control Locked. What you can then do is use the following code to move your selection from the unbound control to the bound control:
Expand|Select|Wrap|Line Numbers
  1. Me.BoundControlName = Me.UnboundControlName
You can put this in the unbound control's after_update event or you can create a button that when clicked (on_Click event) will make the copy.
Apr 19 '13 #2
That is great. Works like a charm

Thanks again
Apr 19 '13 #3

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

Similar topics

1
by: Matt Evans | last post by:
Hi, this must have been asked for before, but I cannot see it. Hopefully this is very simple. I have a form which shows everything from a table. In this table is a picture field called photo....
1
by: Steve | last post by:
I have a form with about 30 fields. Much of data entry for this form involves the same data for many of the fields. To save typing time, in the form's AfterUpdate event I run a procedure that sets...
0
by: Alienz | last post by:
Hey, I was reading the google groups for info on this but the explanation left out exactly how to do the query.. Lets say I have table1 with 2 combo boxes combo1 has a value list of: "new",...
4
by: Altramagnus | last post by:
I have a form first created my the main thread. I have another thread monitoring the IO. Upon receiving certain message, I want to show/unhide the form. When the form is first created ( handle...
5
by: Eugene Turin | last post by:
Hi people. I have a question - how to show existnig form? I create two forms: Form1 and Form2 in designer. I place a button on Form1 and I want to call a Form2 (better in modal mode!). It's...
7
by: Marco | last post by:
The subject pretty much says it all. I need to create a form like the msgbox that returns a value, how would I go about doing this?
2
by: AA Arens | last post by:
I have a form with a combo account manager (choose the name) I have record navigation buttons on that form, along with other fields. I do not use queries, only tables. One of the tables is the...
7
by: ewarts | last post by:
Hello all, I'm having an issue adding more combo box to an existing form, please correct me if I'm wrong in my method but i'm copying the combo box above and pasting it below so to have the same...
2
by: banderson | last post by:
Hello, I have a data entry form for a table with information about buildings and am having a problem making a combo box do what I want. I would like to make the combo box show a list of unique bldg...
4
by: Sep410 | last post by:
Hi All, I have problem with combo box. It is funny but I don't know what to do. When I load my form I load my combos with this Sub: Private Sub CityLoad() Dim sql As String ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.