Report and Query Filtering

ayonae

New Member
Joined
Jul 3, 2007
Messages
29
Hey everyone,

Have a bit of a problem that I need help with! Here it goes.

I have an Equipment Table that contains, Equipment, Primary Connection and Secondary Connection. Primary and Secondary Connection lookup items from the SAME list of Motors. (so the user can select which motor is connected to that equipment, via the primary or secondary connection.. can be different motors!)

Now, in my Report or Query, I"m trying to find a way that it will display the MOTOR - then all the equipment connected to that motor, both from the primary or secondary connection. I don't want seperate headings. (ie connected via Primary connection, then list all equipment) I want to show all the equipment connected to that MOTOR in one list, regardless of primary or secondary.

What Query and code can I use do accomplish that? I can do Motor connected to Equipment via Primary or Secondary seperately, but not in one list.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

CT Witter

MrExcel MVP
Joined
Jul 7, 2002
Messages
1,212
You might want to rethink how you are storing your data. If you were to normalize along the lines of:

Equipment, Motor(ID), ConnectionType

where Connection Type References (1=Primary, 2=Secondary)

Example Data:
Equipment, Motor(ID), ConnectionType
1,1,1
1,2,2
2,5,1
3,6,1
3,7,2

Then you can query for what you have requested. This should also make other reporting a lot easier...ie do I have any motors listed as both a primary and secondary?

BUT, if you want to use your existing data...take a look at the UNION query.

HTH,
CT
 

Forum statistics

Threads
1,181,647
Messages
5,931,207
Members
436,783
Latest member
darkwingduck1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top