473,396 Members | 2,098 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,396 software developers and data experts.

How can I use value in current record as criteria to filter source from another table

So I have a table called IPOrphans with the following fields:

Extension
AELN
Location
RELN

In a form for this table, I’m trying to create a combo box in RELN that uses the value in Location in that same record as criteria to filter choices in the combo box whose source is a different table (called IMCELN) which also contains a field “Location.” I’m trying to match the Location value in the current record of IPOrphans with the Location value in IMCELN to give me a list of choices. This list is a subset of IMCELN.

Example below

IPOrphans Form
Extension AELN Location RELN
72806 72803 WCLL2S <Combo box>

IMCELN Table
Department Location DELN
Infectious Disease WCLL2S 77899
Public Relations WCLL2S 72007
Pathology WCLL2N 77969

I want, if possible, the combo box in IPOrphans form to have at its source a query which uses the Location field of the same record (Value: WCLL2S) as criteria to return only the records for Infectious Disease and Public Relations.

I have searched for a solution for this and come close, but I just can’t get the statement right. Sometimes it comes up asking for IPOrphans.Location (which, if I enter “WCLL2S” will give me the choices I want. I just want it to use the Location field in that record to supply that. Otherwise it uses that value as criteria for the rest of the records.
Sep 25 '14 #1
4 4422
zmbd
5,501 Expert Mod 4TB
To be honest, I'm not quite following your post, but let us prod the question a tad and see where we go (^_^)

If the table relations are set correctly you should be able to do this with a parent/subform arrangement; however, as you are looking that the comboxes, you might take a look thru the following articles on filtering.

Even if these are not an exact match, they may give you enough to solve the question (I'm thinking the Cascaded Form Filtering), or you will read thru these and can come back and tell use which is closest to your current dilemma it would help us to help you find a solution...

One other thing to keep in mind with Combo/list-boxes and often very mis-understood:


[z[edited the following for easier reference from next post]]
  • [Control Source] = is the field in a table that the combo/list-box control will read/write the data within the database.
  • [Row Source] = this is the information that is displayed in the control. It can be a value list, linked to a table/query, or have the SQL embedded within the property.
  • [Bound Column] = This is the actual value returned from the information shown in the control, this value must be the proper data-type for [Control Source]
Therefor, the [Row Source] will be where you will end up in one way or the other to limit the available choices to the user and I think that you almost have the answer here
I want, if possible, the combo box in IPOrphans form to have at its source a query which uses the Location field of the same record (Value: WCLL2S) as criteria to return only the records for Infectious Disease and Public Relations.
which is why I think the Cascaded Form Filtering article is the closest match.

If you don't follow the article, post back here and we'll follow up on it.
Sep 26 '14 #2
Thanks, zmbd.

I looked at the Cascaded Form Filtering article but didn't find it to be exactly what I needed (as far as I could understand it... maybe I'll study it a little more). I know I worded this very awkwardly, so thanks for your reply anyway.

Turns out the parent/subform thing was the perfect solution for filtering the choices. At this point I just need to figure out a good way to transfer the appropriate data from the subform to the parent form. Maybe you have a good idea about how to do that. I've attached a jpg of my current setup (the Select field is just something I'm playing with... I don't really know how to do what I need to do)

Attached Images
File Type: jpg Capture.jpg (24.3 KB, 1783 views)
Sep 26 '14 #3
BTW, I have to get the correct DELN value in the subform into the RELN field in the parent form.
Sep 26 '14 #4
zmbd
5,501 Expert Mod 4TB
I'm not sure your database is normalizedwhich will make your life very difficult; however, not really sure from what you've provided; however, you shouldn't be storing information twice.

In any case, I'm really thinking that the solution is cascading combo, especially if your database is normalized. Once you've done one it's so easy you'll do the palm-to-forhead-slap ( (^_^) I Promise... very very easy)

Please forgive me today, there's an event this weekend that I co-chair for my Church otherwise I'd put a simple example together for you.

But let me see if I can get you to the cascading thing here:
+ The concept is a parameter based query using the control value to feed the query... read thru this for context and the section that were really after is Creating a form to supply parameters to a query because we'll be taking the value of the first cascading combobox - based upon the bound column

+ This query is then used to feed the rowsource of the combo-box
The trick here, is that in the after_update event of the control acting as the parameter, you have to force the combobox to update it's rowsource, because it only takes a picture.

You're basically doing the parent-child, just in a combobox and feeding the table field shown in the control source directly the value of the cbo's bound column.

this link covers the same information as our article; however, from a different angel. I find that sometimes having the same information from two sources often helps me to understand what is going on: Basing one combo box on another - this is a more hand's on tutorial that if you will create the project I almost guarentee that "a-ha" moment (just don't do that palm-slap too hard (^_^) )
Sep 27 '14 #5

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

Similar topics

2
by: Tony Williams | last post by:
I have two tables one lists the names of committees and the other is a list of documents they generate. I have a form based on the documents table which gives details of the document including...
1
by: Michael Israel | last post by:
I am new to Access. I have a form with a single record. The keyed field is PropID (number). I want to run a query from the form that will have the current value of PropID be the variable in the...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
0
by: 2D Rick | last post by:
I input data into two textboxes on Form1 which returns three records into Form2. I then Print record 2of3 using criteria from Form2. stLinkCriteria = "= '" & Forms!! & "'" & " AND = '" &...
2
by: Deano | last post by:
Problem is that there are lots and lots of fields in an employee record. I specify a form control as the criterion for one of those fields which is the value of the primary key for that record. ...
1
by: Beeker | last post by:
I have a table called 'RawData' that collects production data. We run a report on this data everyday to see the performance of each employee. I have another table called 'tblStandards' with...
2
by: jhoelter | last post by:
Hi, First of all, I thank you for reading the following post and taking a little bit of your time helping me figuring this out. I first tryed to explain my exact case, but it is to hard. Let me...
0
by: ramachandradurai | last post by:
hi, i am getting the error like.. Either EOF or BOF is true, or the current record has been deleted.Requested operation requires the current data. <%@ LANGUAGE="VBSCRIPT" %>...
2
by: rcjay272 | last post by:
All, I am new to creating scripts to run on SQL. My goal is to create a script that allows me to query one table for an "id" value and then run a delete statement on another table to delete a...
12
by: ssmvijay | last post by:
Hai everybody...! I have a problem here .. Hope I can get help by answers.. I have a table A ID DATA 1 aa;bb 2 aa;bb;cc 3 aa;cc 4 bb;cc
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
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
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...

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.