Results 1 to 4 of 4

Setting color in SQL query

  1. #1
    Giewont90 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    2

    Setting color in SQL query

    Hello everyone !
    I have a problem with a task to my "Database Systems" classes at my University.
    The task is :
    To create the query which result is : printing names of students in blue color.

    I was trying like this :
    Code:
    SELECT Format(Students.[Name],"[blue]")
    FROM Students;
    But it doesn't work - names are still black.
    I must do it using only SQL, not properties of table.
    Is it possible ?

    Sorry for my English.

  2. #2
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    26,937
    Don't think can build into the SQL statement. Use properties of query. With Access query in Design View, select column, and in the Properties window, enter this in Format property: [Blue]@. Works only with text data. Number type would have to be converted, CStr([number field]). Now view the query in SQL view, the format parameter does not show in the statement.

    This can be done with table or query. Do it in table and the property will carry over to query.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

  3. #3
    Giewont90 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    2
    Yes, I know this way of solving problem. But I was curious, if it is possible through SQL code.

  4. #4
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    26,937
    Apparently not. If Access doesn't build it into the SQL string, then don't see how could build it in a VBA coded SQL string. However VBA code might be able to change this Format property of the saved Access query.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change font color in Query
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 01-10-2013, 07:14 PM
  2. Replies: 1
    Last Post: 11-01-2010, 05:59 PM
  3. VBA setting parameter to append query
    By rpiller in forum Programming
    Replies: 1
    Last Post: 09-30-2010, 03:02 PM
  4. Setting a Color on a Control For Error
    By AccessLes in forum Programming
    Replies: 6
    Last Post: 06-16-2010, 11:35 AM
  5. Replies: 5
    Last Post: 10-08-2009, 04:15 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums