Adding "New" to Combobox (1 Viewer)

gbnz

Registered User.
Local time
Today, 14:02
Joined
Mar 12, 2010
Messages
63
Hi Everyone,

I have a question and I am not having any luck finding it out. I want to display the word "New" in a combo box's dropdown list along with the query I have set for it. So if there are no items the word "New" is the only thing listed or if there are items the word "New" is listed at the bottom of the list.

Thanks a heap!
 

gbnz

Registered User.
Local time
Today, 14:02
Joined
Mar 12, 2010
Messages
63
Okay I have worked on this and have come up with a conclusion if anyone is interested.

I put this code in the Form_Load event:

Code:
If IsNull(DLookup("User", "qUser")) Then
    Me.Combo14.RowSourceType = "Value List"
    Me.Combo14.RowSource = "New;(NEW)"
Else
    Me.Combo14.RowSourceType = "Table/Query"
    Me.Combo14.RowSource = "UserComboBox"
End If
So it looks for a User entry in the query qUser if there isn't any it displays "(NEW)" in the dropdown list of the Combo Box. I don't know why the first "New" isn't displayed but it works.

The UserComboBox is a Union Query to display the word "(NEW)" plus the rest of the query. Below is the SQL for that query.

Code:
SELECT "0" as [UserID],"(NEW)" as [User] FROM User UNION SELECT User.UserID, User.User FROM [User]
ORDER BY [UserID];

If anyone else has anything that would be better please share and thanks for the looks.

gbnz
 

gbnz

Registered User.
Local time
Today, 14:02
Joined
Mar 12, 2010
Messages
63
So it looks for a User entry in the query qUser if there isn't any it displays "(NEW)" in the dropdown list of the Combo Box. I don't know why the first "New" isn't displayed but it works.
Sorry to post again but I figured out why the dropdown was not displaying "New" but was able to display "New;(NEW)". The combo box is set to two columns ([ID],[User]) with ID hidden. So with only "(NEW)" set it was hidden.

Cheers
 

Users who are viewing this thread

Top Bottom