Results 1 to 14 of 14
  1. #1
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81

    Unanswered: Adding "Select All" Option in the combo box

    hey,
    How could we add "Select All" option in the combo box. As we could do in access as
    SELECT DISTINCT Type.description,Type.description FROM Type UNION Select "(All)" as Bogus, "*" as AllChoice From Type
    ORDER BY Type.description;
    But in sql server how could we hv the same functionality????

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    SQL Server supports UNION queries.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by musman
    "*" as AllChoice From Type
    You do know that, that this will return n number of "*"'s based on the number of rows in that table


    SELECT DISTINCT description FROM Type
    UNION ALL
    SELECT '*' AS description
    ORDER BY Type.description

    However, ot picking anything should be construed as "ALL" in the first place

    WHERE description = COALESCE(@description,description)
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81
    I did this but despite of supporting this type of query its not displaying. (ALL) in the combo box and so messing my coding....
    cud plz write a little piece of code that's need to be write..thx

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Do you mean all is causing a problem?

    WHERE description = CASE WHEN @description = 'ALL' THEN description ELSE @description END

    ?????
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81
    Well, What i hv is the query

    SELECT DISTINCT Type.description,Type.description FROM Type UNION Select "(All)" as Bogus, "*" as AllChoice From Type ORDER BY Type.description;


    right?
    and its running in access.... Good..and also access code is working fine.
    now after conversion in sql server, the combo box that is associated to this query is populating with the data as in access but the only thing missing is the option "ALL" and that would be default and first option for the combo box...Its not coming and i hv code in vb that is running according to "ALL" and '*' options....
    and there is not any parameters coming from out side.....
    So cud that be solved.

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Is this an access problem?
    If so you're
    1) posting in the wrong thread and
    2) going about this the wrong way.
    George
    Home | Blog

  8. #8
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81

    Lightbulb

    Nope this is not access problem
    this is problem in sql server.
    i wanna make this same query run in sql server....

  9. #9
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Nope it's an access problem

    You are probably trying to use this as a datasource

    You probably need to make this an unbound control, then call the sql, then use the result set and assign it to the control

    But you might find more help in the Access Forum.

    I'm going to move this thread
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  10. #10
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by musman
    SELECT DISTINCT Type.description,Type.description FROM Type UNION Select "(All)" as Bogus, "*" as AllChoice From Type ORDER BY Type.description;
    this query has several minor errors, but you know what? it probably still works

    here is the same query, converted to SQL Server syntax, with a couple of improvements
    Code:
    SELECT description
         , description  
      FROM Type 
    UNION ALL
    SELECT '(All)' 
         , '*'
    ORDER 
        BY description
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  11. #11
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I'd like to clear this up!
    What is the front end application?

    What are you trying to achieve in plain and simple English please
    George
    Home | Blog

  12. #12
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    if english is not the original poster's native language, the requirement to use "plain and simple english" could be a bit off-putting
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  13. #13
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Please provide us clear and concise business requirements
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  14. #14
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81
    Actually our company has upsized its Access database to sql server. Now there are certain thing that upsizing wizards dont do. So that things needs to be fixed. Now having backend in sql server and front end in access i was having trouble in populating the combo box with (ALL) word in the combo box.and above query that "r937" told me is pretty help ful at least now i can have this key word. now i m gonna take a look on its functionality...
    Thx all of you.

Posting Permissions

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