All right, I’ve got two tables in my Access 2007 database (well, more than that, but the question applies to these two…):
part
part_no
...
supplier_id
special_supplier_id
...
And
supplier
supplier_id
supplier_nm (NB: Caption="Supplier Name")
special_supplier_flg
Now I’ve built a query :
SELECT p.part_no, s.supplier_nm, ss.supplier_nm AS special_supplier_nm
FROM
part AS p INNER JOIN
supplier AS s ON p.supplier_id = s.supplier_id INNER JOIN
supplier AS ss on p.supplier_id = ss.supplier_id
All well and good, and it seems to work for the simple select (if there are any errors in the query itself, it’s an artifact of retyping it for the question, and not what the question is about), and should work for code applications as well.
The problem, though, is that if I open the datasheet view of the query, both of the name fields are labeled “Supplier Name”. Is there any way around this?
Try this:
However, if you’re using the query builder you may need to be careful not to build the query with the “default” alias (from the caption) first, because that seems to stick around in some not-visible metadata.
Also, if you can edit this query in Access’ query builder, if you right click on the field in question there is an option to set the caption property inside the query, and this will override whatever caption was on the original table column.