Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Title Listbox

Status
Not open for further replies.

phpatrick

Programmer
Jul 9, 2006
72
BE
hi, I like to set the title of the listbox on top of the list with a sql statement.

I've seen something like below, but you need another query, I do not need a query, because my title of my textbox is not in a query.
Code:
SELECT 0, " CANDIDATES " FROM [Q-01-FIRM-CANDIDATES] UNION SELECT [ID-FIRM],[F-NAME] FROM [Q-01-FIRM-CANDIDATES]
ORDER BY 2;

any id ?
 
It's probably
Code:
SELECT TOP 1 0 As [ID], 'CANDIDATES' As [Name] 
FROM [Q-01-FIRM-CANDIDATES] 

UNION 

SELECT [ID-FIRM],[F-NAME] 
FROM [Q-01-FIRM-CANDIDATES]

ORDER BY 1;
Assuming that [ID-FIRM] is a numeric field.

That Should result in something like
[tt]
0 CANDIDATES
10 Sam
11 Fred
12 Bill
etc.
[/tt]
 
merci,

it works ! The title is selected on top as the default value
(O). Little bug remains. When dropdown The title has now becoming an item of the list. When dropdown the TITLE may NOT be in the list.

How can I fix this ?
 
atre you saying, that you want the title as part
of the selection?
I think you're saying, you just want the columns with
a title header, according to the title of the listbox,
NOT the fields.

If so, Maybe it's simply,


SELECT [ID-FIRM] As [0],[F-NAME] As [Candidates]
FROM [Q-01-FIRM-CANDIDATES]

On ListBox properties select, ColumnHeader to yes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top