Query always pulls ALL fields from tables

H

HMJessen

Until recently (2-3 months ago) I never noticed this problem, but now when I
make a query it pulls ALL the fields from all tables in the query.

An example: I ask for a listing sorted by Last Name, First Name. Two
fields only.
The query generates a SQL that says:
SELECT Personnel.LastName, Personnel.FirstName, *
FROM Personnel
ORDER BY Personnel.LastName, Personnel.FirstName;

That comma and asterisk are the killers.

Does anyone know why Access would add this if I am not asking for it?
Anyway to prevent it from happening?

Thank You!
 
D

dantebus

The problem is you ARE asking for it, that's what the * indicates. Simply
remove the , * and just have:

SELECT Personnel.LastName, Personnel.FirstName
FROM Personnel
ORDER BY Personnel.LastName, Personnel.FirstName;
 
J

Jerry Whittle

Either in the specific query or under Tools, Options, Tables/Queries tab you
have Output All Fields selected.

That adds the * no matter how you create the query.
 
M

Michel Walsh

Hi,



The * is added if the query's property "Output All Fields" is set to yes.


Hoping it may help,
Vanderghast, Access MVP
 

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