473,587 Members | 2,527 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 1015
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 ("SubOrganisati on") based on the organisation, drag it onto the main form and set the LinkMasterField s & 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,566 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
1911
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 an item in the combo box, I need to use my mousefor the selection. If I use the 'DOWN/UP' keystroke, the cell inthe grid move to the next or prev row...
2
2618
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 order in the query and the letters ar not sorted.
2
1465
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
1354
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 written to the record. For example: Combo options from value list are Day(s), Week(s), Month(s), Year(s) When Day(s) is selected in the combo box, I...
5
1922
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 one record in the fields in the frmDeleteComponent form. There is also a lstDelete listBox which displays all the record. But for some reason it...
11
5654
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 form which has "Add Similar To" button. The table which i used to store records contains a field call "Add More Quantity". If a user enters any...
20
2964
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 Combo Box 2 to change based on Combo Box 1 answer. Combo Box 2 will still be editable but its default will be based on Combo Box 1. Example: I have...
1
3234
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 combo boxes. I am encountering problems with getting the data value from one of the combo boxes (for divisions and groups) to be updated on the record. ...
8
8727
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 that table as a record source. I want to use the same form each time but change the record source based on the table I select from my combo box. ...
0
7918
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7967
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5713
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
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 we have to send another system

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.