Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    110

    Unanswered: Query field name aliases

    Hello everybody

    I have been informed that I can use the ':' operator to input alias names for the fields of a query. That is true and works.
    What if I manually execuite an SQL query using VBA and assign the RowSource property of a list box the recordset returned. Can I somehow use aliases for the field names in this case?

    e.t.c

    ' Create a query
    strSelect = "Select * FROM TEXNIKOS"

    [Texnikoi_List].RowSource = strSelect

    Where Texnikoi_List is a list box component.

    I now get as as field titles the original names of the fields, which are rather ctyptic.

    George Papadopoulos

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi George

    I'm afraid you have to name each field in turn and provide the alias e.g.

    Select [field1] AS [field1NewName], [field2] AS [field2NewName] from [TableName]

    If you open up the query you produced the aliases using the ":" operatator, and look in the SQL view you will see what Access does to create aliases (basically the SQL reads as above), and you can copy and paste if you don't fancy writing it out again from scratch (although you will learn more by writing it out)

  3. #3
    Join Date
    Apr 2004
    Posts
    110

    Smile

    thx, rather easy it was. Ignorance is our worst enemy.

    The only question I have is how can I use an alias with spaces in it?

    George

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You can use spaces in your Alias name as long as it is between the brackets []
    PHP Code:
      SELECT inst.kname AS [Any_N A M E]
         
    From inst 

  5. #5
    Join Date
    Apr 2004
    Posts
    110
    nice! thx, very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •