List Box Headings

S

Steve Walker

Access 2000. I have a list box that is based on a query. The values of the
headings are based on the query. Can I change these to headings which are
user friendly e.g. InstructorID to Instructor etc. Tried a bit of VBA but
not successful

Any comments or web site examples would be appreciated.

Steve
 
S

Steve Schapel

Steve,

In your query, alias the field names, for example...
Instructor: InstructorID
 
S

Steve Walker

The query I've got includes 3 tables (tblLesson, tblStudent and
tblInstructor), your solution works fine (thanks for that) on the lesson
table but any other changes to the Instructor table and Student table does
not work. Could this be because they have the same heading e.g. surname
instructor and surname student. Tried using alias Name in instructor, didn't
work.
 
S

Steve Schapel

Steve,

Not sure I 100% understand the question. But I don't think you will be
able to use an alias which is the same as the actual name of another
field in one of the tables. Also, I have never tried this, but I
imagine Access might object if you try to use a "reserved word" as an
alias. Examples of reserved words are: name, date, value.

If I have missed the mark, please post back with the SQL view of the
query, and let us know what is happening different from what you expect.
 
S

Steve Walker

Thanks for the reply Steve



The select query:

SELECT [qryDaily].[Lesson], [qryDaily].[Instructor],
[qryDaily].tblINSTRUCTOR.Surname, [qryDaily].[StudentID],
[qryDaily].tblSTUDENT.Surname, [qryDaily].[Date], [qryDaily].[Start Time],
[qryDaily].[Lesson Type] FROM qryDaily;



If I change LessonID to Lesson the select query gives me Lesson on the
heading for that field. If I try and change tblSTUDENT.Surname to
Surname:tblSTUDENT.Surname the query acts like a parameter query asking for
the name. I'm now wondering if I should use the qry as the source and not
SQL - could I be heading in the right direction? I'll try it!



Steve
 
S

Steve Walker

Cracked it Steve - I based the list box on the qry and not an SQL select
query. It now seems to work. Thanks for your help certainly made me think
and got me in the right direction.
Cheers
Steve
 

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