473,465 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Combo related query

12 New Member
I have a form with two combos. Both source from a single table (the same one). When the first on the top is selected it enables the ones below. The issue is that I would like to link the two. In other words the first combo is Projects and the second one is Supplier. Right now when I select the project all the suppliers show in the combo below while I'd like to show only the suppliers related to that project.

Any help?

Attached Images
File Type: jpg combo.JPG (24.5 KB, 361 views)
Feb 14 '19 #1
6 1501
PhilOfWalton
1,430 Recognized Expert Top Contributor
Nslotto. Before going any further, please read any articles you can find on Database normalisation. In particular, you will find that a table should contain information about one subject and that subject should exist in it's own right.

So you should have a table of projects (and obviously they have no direct connection to the Supplier, and a table of Suppliers which is basically a "free standing" list of people.

Assuming the primary key for the Suppliers is SupplierID (AutoNumber), we link the two tables together by having the SupplierID as a foreign key in the Project table (assuming there is only one supplier per project. If more than one supplier can be involved in a single project, it gets a bit more complicated, but I'll deal with that if the situation arises)

See how you get on, and if you care to send an image of the relationship page, we can check that over, and then get back to the Combo Boxes.

Phil
Feb 14 '19 #2
nsiotto
12 New Member
Hi Phil, I couldn’t find anything similar to my question. Which of course doesn’t mean it’s not there but couldn’t find.

So let me answer what I believe to be the most important question you have made in response to mine. I have one table which has all the data and it is called “Main”. Combos source the data from one of the records and it is grouped. So both Project and Beneficiary are grouped and will appear as one entry but in reality on the Main table are many. That’s why shouldn’t be impossible to show on the Beneficiary combo only the records matching the Project. Did I manage to make my reply clear?
Feb 14 '19 #3
PhilOfWalton
1,430 Recognized Expert Top Contributor
As I said, you need either 2 or 3 tables.

I gather you are saying that one project can have several beneficiaries. In which case you need the 2 tables I have already mentioned
Does the reverse also apply that one Beneficiary can be involved with more than 1 project? In which case you need 3 tables.

Either way you will need TblProjects and TblBeneficiaries. The latter table will hold things like name, address, contact detail etc. The former table will probably have a ProjectRefNo and bank details.

Your first post mentions a supplier. Where does that fit in?

Try to avoid meaningless table names like "Main". Use something descriptive like "TblProjects" then you have an idea of the information it will hold.

Phil
Feb 14 '19 #4
nsiotto
12 New Member
Phil, this MS Access database exists since almost ten years. I am just trying to enhance some functions such as report in this case. Report works. The only issue is that I wanted when selecting a Project to show in the combo below only the Beneficiaries (which are the suppliers) that have been engaging on that particular project.

Now let's come to the table.

Attached Images
File Type: jpg Capture.JPG (15.0 KB, 262 views)
Feb 14 '19 #5
nsiotto
12 New Member
As you can see apart from Switchboards, user table there's only one working table and everything is present inside this table. So what has been done in the combos it is possible not only to select but also to edit and to insert a new information. Which means that this becomes available in that record which is grouped although there are so many records with different projects names and different beneficiary names. So the Projects and the Beneficiary are sourced from the Main table.

Here's the query for Project combo:
Expand|Select|Wrap|Line Numbers
  1. SELECT main.project FROM main GROUP BY main.project ORDER BY main.project; 
And here the one for Beneficiary combo:
Expand|Select|Wrap|Line Numbers
  1. SELECT main.beneficiary FROM main GROUP BY main.beneficiary ORDER BY main.beneficiary; 
In Main table for each record there is one Project and one Beneficiary. It would be nice that when the Project name is selected in the combo, automatically the query in the Beneficiary combo shows only the ones that are present in the Project.
Feb 14 '19 #6
PhilOfWalton
1,430 Recognized Expert Top Contributor
I'm sorry, I can give you no further help. Again, if you look at table normalisation, you will see that if the same piece if Alpha data (ProjectName), the database is not normalised, and you will run into trouble. The way you have set out your table the ProjectName will appear once for each beneficiary, so what happens when the Project name is unintentionally mistyped. "ProjectABC" is not the same as "Project ABC", so your Combo box may show "Fred" as the beneficiary in "ProjectABC" and "John" in "Project ABC". I know what you are trying to do id type in "ProjecxtABC" and see both Fred & John's names. It won't work.

You need a main form for the Project, and a linked continuous Subform for all the Beneficiaries.

I can't find anything very close to what you need, but here is an image of the closest thing I have got.



So wherever you see the word "Interest", use Project, and where you see the "Member", think Beneficiary.

I am sorry not to help further, but if the underlying structure of your database is wrong, it is not my policy to encourage you to proceed further, as we may solve this particular problem, and you will be back in a few weeks with another problem caused by a non-normalised database.

Phil
Attached Images
File Type: png Interests1.png (22.9 KB, 273 views)
Feb 14 '19 #7

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

Similar topics

5
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the...
1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
1
by: Me | last post by:
Hi, In my application, I have two records, customers and transactions.Each customer may have many transactions and so I have created a one to many relationship between them. I have a form...
2
by: Steve | last post by:
Access 97. I have a form where there is an option group with two buttons, and a combo box. The combo box Row Source is a query. The option group has two options a) include a subset of the...
2
by: Isaac Rajan | last post by:
Hello, I am developing an Access Data Project (ADP) that connects to MSSQL server 2000. I have a combo box on a from that has a stored procedure as the row source. The stored procedure has a...
0
by: SalimShahzad | last post by:
dear gurus, I have one problem. i have listed some cities say london, tokyo, newyork,ALL. now based on the combo selection after update. it pass the value to a report query and results comes of...
20
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
1
by: didihynes | last post by:
Hi Guys, I'm in desparate need of help. I am producing a database for my dissertation and have got majorly stuck. I am currently creating a form in which the user will select a student from a...
29
by: Chad Brewer | last post by:
I have a form that has two tabs. One is called New Request and the second tab is called Follow Up. Each of these tabs have fields on it that come from a query that has linked two tables (New...
5
by: Haagimus | last post by:
I am trying to create an access form that will have multiple combo box drop downs. There are two that will need to be linked in the form. The selection of the first will need to become the query...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.