473,498 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filtering a ListBox based on two tables.

2 New Member
Hi All,

I'm getting used to using access so go easy on me.

The issue I'm having is getting my list box to provide the correct data. Based on two tables information.

I have two tables one called CustomerT and one called CustomerOrderT they both have a field called CRM ID, this is a one to many relationship. I have a CustomerF form that displays all of the data from the CustomerT table based on the CRM ID, I would also like it to display the last orders from CustomerOrderT based on the CRM ID. The ListBox currently shows all orders regardless of the CustomerF CRM ID displayed.

I hope this is enough of an explanation but please ask me for more info if needed.

Thanks.
Jul 6 '17 #1
4 1717
PhilOfWalton
1,430 Recognized Expert Top Contributor
Information is fine.

What is the RowSource of your listbox?

I would add that the more usual way of handling a Customer & Order situation is to use a subform to show all the orders.

If you look at the Northwind database Order Details Form, you will get the idea

Phil
Jul 6 '17 #2
TurnItOffAndOn
2 New Member
The Row Source is SelectCustomerOrdersT.

The actual table is a tracker as appose to filling in the full order. So each record is updated at a different stage, which is why I'm using a table to store the info. I'm displaying 3 fields from that table in my ListBox.
Jul 6 '17 #3
PhilOfWalton
1,430 Recognized Expert Top Contributor
Sorry, that is not a valid Rowsource. Please check it carefully

It should be more like
Expand|Select|Wrap|Line Numbers
  1. SELECT CustomerOrderT.* FROM CustomerOrderT
  2. WHERE [CRM ID] = Forms![YourFormName]![CRM ID]
  3. ORDER BY CustomerOrderDate DESC;
  4.  
You'll obviously will have to use the correct name of ypour form and the order date

Phil
Jul 6 '17 #4
NeoPa
32,557 Recognized Expert Moderator MVP
I'm guessing that [SelectCustomerOrdersT] is actually the name of a QueryDef.

Perhaps you could post in the SQL used for [SelectCustomerOrdersT] so that we can review it.
Jul 6 '17 #5

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

Similar topics

10
2748
by: Sjaakie | last post by:
Hi, I'm, what it turns out to be, fooling around with 3-tier design. At several websites people get really enthusiastic about using custom dataobjects instead of datasets/-tables. While trying to...
0
1217
by: dentyne | last post by:
Good morning, I have a typed dataset with 10 relational, hierarchical tables. I want to be able to "filter" all the dataset tables based on one parent record. For instance, let's say I have a...
0
1264
by: spowel4 | last post by:
VB 2005: Using an xml file as the data source, I need to fill a listbox with data based upon what was selected in a combobox. In other words, my data consists of a list of customers in a...
6
3357
by: BerkshireGuy | last post by:
On an unbound form, I have a combobox called 'cboproducttype' and a text box called 'txtamountappliedfor'. I have an Add button that I would like the user to be able to hit once a product and...
5
3854
by: datasec23 | last post by:
Hi...I am trying to get my listbox data to change based on a field on a form. Each time I click on the next record indicator at the bottom of the form, I would like the Listbox to change...
3
1994
by: RamiH | last post by:
Hi, I am using a listbox to show data from a certain table, i want the user, after the listbox is filled, to be able to sort the data according to the column of his choice. I could sort the table...
7
2207
stonward
by: stonward | last post by:
Hi Guys, I feel this should be straightforward, but I'm struggling. I have a listbox that displays the results of a filter/query - including the PK. I need to show just those same filtered...
2
13019
by: pwag | last post by:
Good Afternoon, I'm trying to auto-select items in a multi-select listbox based on a column's criteria in a VBA Sub. Here is my code thusfar that fails. All values are text data type. Any...
0
7004
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
7167
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
7208
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
6890
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
5464
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,...
1
4915
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
4593
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...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.