473,513 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

selecting a record based on value in a combo box

1 New Member
I have two tables. One of the table contains data on the individual while the other table has data on the organization/corporation. I have created combo box on the main form to select the organization/corporation with which the individual is associated. Now I would like to open a sub-form (using the open form command button) to display data of the organization/corporation I have selected in the combo box. Any help will be much appreciated.
Jan 4 '17 #1
2 1007
PhilOfWalton
1,430 Recognized Expert Top Contributor
Bit thin on information, so I shall make the following assumptions.

In your table of individuals you have a Foreign Key pointing to the Organisation to which the individual belongs.
Your main form is for the individual and you are using a Combo Box to select the appropriate organisation.
The Primary Key for the Organisation table is "OrganisationID" and the foreign key in the Individual table is also "OrganisationID"
The Combo Box is Bound to OrganisationID in the Individual Table.

Having created your subform ("SubOrganisation") based on the organisation, drag it onto the main form and set the LinkMasterFields & LinkChildField to "OrganisationID"

On the After Update of the Combo box, you need to refresh the subform so use something like this

Expand|Select|Wrap|Line Numbers
  1. Private Sub OrganisationID_AfterUpdate
  2.     SubOrganisation.Requery
  3. End Sub
  4.  
There are other alternatives methods without using a subform as well.

Phil
Jan 4 '17 #2
NeoPa
32,557 Recognized Expert Moderator MVP
If you're opening a form on the click of a button it's almost certainly NOT a sub-form (See Referring to Items on a Sub-Form).

To use a ComboBox control to help you filter from the existing data such that you can find a particular record more easily have a look at Cascaded Form Filtering or some of its linked pages.
Jan 5 '17 #3

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

Similar topics

1
1905
by: Amin Gunawan via .NET 247 | last post by:
I would like to put a combo box in a column of a datagrid. I've seen the samples in the MSDN library of other sources, butall samples didn't catch the 'DOWN/UP' keystroke. It means thatwhen I select...
2
2614
by: Steve | last post by:
Does any anyone have a procedure for a query where a calculated field returns the previous record's value in another field. For example: A F A Z F M Z The primary key is in random...
2
1463
by: john | last post by:
Is there a hotkey in Access that pastes the previous record's value in a field? In Excel it's Ctrl-D. Thanks, john
2
1350
by: ringer | last post by:
I use a combo box to select a value from a list but I don't want what is selected to be written to the record. I need each selection of the combo box to correspond to another value that should be...
5
1915
by: agarwasa2008 | last post by:
Hi, I would like to delete a record based on a user entered string. Here are the details. I have a txtFind textbox. A string is entered by the user. Based on that string value it displays that...
11
5623
by: prashantdixit | last post by:
Hi, I am developing a stock control software. Iam stuck somewhere. I have a form "Add new stock" consisting of combobox, text boxes etc. which is used to add records in a table. I have another...
20
2948
by: Daniel Yantis | last post by:
Combo Box 1 Displays a query/list with 2 columns: SELECT Classes.CLASS_DESC, Judges.Judge, * FROM Classes; Combo Box 2 Displays a query/list: SELECT Judges.Judge FROM Judges; I want...
1
3225
by: ncsthbell | last post by:
Hello, I hope I can do a good enough job trying to explain this situation! I have inherited the maintenance for an access database and I have been requested to make a change to a form to add 2...
8
8709
Teresa Kline
by: Teresa Kline | last post by:
I have a form with a combo box. In the combo box is a list of tables in my database. I want to be able to select a table from my combo box and based on that selection open another form that uses...
0
7260
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
7539
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
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...
1
5089
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
4746
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
3234
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
1596
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 ...
1
802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.