Query Problem - Numbers not Names

S

Scuda

Evening all. I have a Select query (code at bottom). My problem is that when
I attempt enter a name for the query (controller) it shows nothing. I believe
this is because the controller lookup I have in the table is a combo box from
another table. So, if I type in thier ControllerID number, it returns the
query. How can I make this work for the name?

Thanks so much, Steph


SELECT tblSENEIncidentLogCY.MISLE_Number,
tblSENEIncidentLogCY.[SENE_CASE_#], tblSENEIncidentLogCY.DAY,
tblSENEIncidentLogCY.FY, tblSENEIncidentLogCY.[NATURE OF DISTRESS],
tblSENEIncidentLogCY.CONTROLLER, tblSENEIncidentLogCY.LIVESSAVED,
tblSENEIncidentLogCY.LIVESASSISTED, tblSENEIncidentLogCY.[Case Description],
tblSENEIncidentLogCY.ASST_CONT_BI, tblSENEIncidentLogCY.MONTH
FROM tblSENEIncidentLogCY
WHERE (((tblSENEIncidentLogCY.CONTROLLER) Like "*" & [Enter in Controller
Name (partial works)] & "*"));
 
U

UpRider

Steph, forget the third parens, that won't work. Sorry I miscounted the
pairs.

UpRider
 
D

Douglas J. Steele

Sounds as though you might have used the Lookup Wizard when creating your
table.

If that's what you've done, while it may look as though there's a name in
Controller field, there really isn't.
 
J

John W. Vinson

Evening all. I have a Select query (code at bottom). My problem is that when
I attempt enter a name for the query (controller) it shows nothing. I believe
this is because the controller lookup I have in the table is a combo box from
another table. So, if I type in thier ControllerID number, it returns the
query. How can I make this work for the name?

Thanks so much, Steph


SELECT tblSENEIncidentLogCY.MISLE_Number,
tblSENEIncidentLogCY.[SENE_CASE_#], tblSENEIncidentLogCY.DAY,
tblSENEIncidentLogCY.FY, tblSENEIncidentLogCY.[NATURE OF DISTRESS],
tblSENEIncidentLogCY.CONTROLLER, tblSENEIncidentLogCY.LIVESSAVED,
tblSENEIncidentLogCY.LIVESASSISTED, tblSENEIncidentLogCY.[Case Description],
tblSENEIncidentLogCY.ASST_CONT_BI, tblSENEIncidentLogCY.MONTH
FROM tblSENEIncidentLogCY
WHERE (((tblSENEIncidentLogCY.CONTROLLER) Like "*" & [Enter in Controller
Name (partial works)] & "*"));

As Douglas says, you're another victim of Microsoft's misdesigned, misleading,
infuriating Lookup Wizard:

http://www.mvps.org/access/lookupfields.htm

Your table APPEARS to contain a controller name. It doesn't. It contains a
hidden number field; the controller name is stored in the lookup table.

You can still salvage your query by joining the lookup table to it:

SELECT tblSENEIncidentLogCY.MISLE_Number,
tblSENEIncidentLogCY.[SENE_CASE_#], tblSENEIncidentLogCY.DAY,
tblSENEIncidentLogCY.FY, tblSENEIncidentLogCY.[NATURE OF DISTRESS],
tblControllers.CONTROLLER, tblSENEIncidentLogCY.LIVESSAVED,
tblSENEIncidentLogCY.LIVESASSISTED, tblSENEIncidentLogCY.[Case Description],
tblSENEIncidentLogCY.ASST_CONT_BI, tblSENEIncidentLogCY.MONTH
FROM tblSENEIncidentLogCY INNER JOIN tblControllers
ON tblControllers.ControllerID = tblSENEIncidentLogCY.CONTROLLER
WHERE (((tblControllers.CONTROLLER) Like "*" & [Enter in Controller
Name (partial works)] & "*"));

You'll need to replace tblControllers with the actual name of your lookup
table - view the Lookup properties of the CONTROLLER field in table design
view.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top