• SQL Alias (A97 SR2)

    Author
    Topic
    #357613

    I want to create a combo box on a form showing headings. I have specified the headings using the AS [HeadingName] in the combo box rowsource SQL statement, but as the base table column has a caption defined, it is the caption from the table which appears, and not my Alias name. Is there an easy way to ignore the Caption from the table without amending the table design ?

    Thanks for your help

    Nick

    Viewing 1 reply thread
    Author
    Replies
    • #531631

      Charlotte

      Your reply seems to have got lost, but here’s some more info :

      My SQL was :

      SELECT Sectors.TechLogNumber AS TLP,
      tblAircraft.Registration AS Reg,
      Sectors.[Actual Departure Date] AS [Date],
      [Sectors]![Departure Airport] & “-” & [Sectors]![Arrival Airport] AS Route
      FROM tblAircraft …etc

      In the comboBox header, the 2nd column appeared as “Aircraft Registration”, which is the Caption field in tblAircraft for field Registration, and not as “Reg”, which was what I wanted to see.

      HTH

      Nick

      • #531714

        The alias appies to the field, not its caption. When you set the field alias, that is used as if it were the field name elsewhere in the query and in any form or report based on the query. The easiest workaround is to make sure you use a saved query as the row source for you combobox. Go into the saved query and set the caption property for the field in question to the caption you want to use instead of the table field’s caption.

    • #532073

      Thank you Charlotte

      It now works perfectly

      Nick

    Viewing 1 reply thread
    Reply To: SQL Alias (A97 SR2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: