A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding an extra choice to a ListBox



 
 
Thread Tools Display Modes
  #1  
Old July 7th, 2004, 07:07 PM
April Marano
external usenet poster
 
Posts: n/a
Default Adding an extra choice to a ListBox

Hi all,

Can I populate a ListBox (or ComboBox) with the rows drawn from a query AND
the choice "All" listed as the first row of the ListBox? If so how?

This box would allow the user to filter some data based on the row selected
or to not filter at all (at least based on that one field).

Thanks for any help in advance!




  #2  
Old July 7th, 2004, 07:13 PM
April Marano
external usenet poster
 
Posts: n/a
Default Adding an extra choice to a ListBox

By the way, I'm using Access 97.

"April Marano" wrote in message
...
Hi all,

Can I populate a ListBox (or ComboBox) with the rows drawn from a query

AND
the choice "All" listed as the first row of the ListBox? If so how?

This box would allow the user to filter some data based on the row

selected
or to not filter at all (at least based on that one field).

Thanks for any help in advance!






  #3  
Old July 7th, 2004, 07:56 PM
PC Datasheet
external usenet poster
 
Posts: n/a
Default Adding an extra choice to a ListBox

Make an Union Query out of your query and another query that returns the word
"All". Look in the Help file to create the correct query containing "All".

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications

www.pcdatasheet.com


"April Marano" wrote in message
...
By the way, I'm using Access 97.

"April Marano" wrote in message
...
Hi all,

Can I populate a ListBox (or ComboBox) with the rows drawn from a query

AND
the choice "All" listed as the first row of the ListBox? If so how?

This box would allow the user to filter some data based on the row

selected
or to not filter at all (at least based on that one field).

Thanks for any help in advance!








  #4  
Old July 7th, 2004, 08:22 PM
April Marano
external usenet poster
 
Posts: n/a
Default Adding an extra choice to a ListBox

Great, that makes sense. Now how do I sort this new query in such a way
that "All" appears as the first row?

April

Make an Union Query out of your query and another query that returns the

word
"All". Look in the Help file to create the correct query containing "All".




  #5  
Old July 7th, 2004, 08:44 PM
PC Datasheet
external usenet poster
 
Posts: n/a
Default Adding an extra choice to a ListBox

If you have no other choices at a lower alphabetical order than "All" you just
need to sort ascending. If you have lower level choices, use "All". Special
characters sort lower than alpha characters so "All" will appear first sorted
ascending.

Steve
PC Datasheet

"April Marano" wrote in message
...
Great, that makes sense. Now how do I sort this new query in such a way
that "All" appears as the first row?

April

Make an Union Query out of your query and another query that returns the

word
"All". Look in the Help file to create the correct query containing "All".






  #6  
Old July 7th, 2004, 11:16 PM
April Marano
external usenet poster
 
Posts: n/a
Default Adding an extra choice to a ListBox

Thanks Steve. I'll try that.

April

"PC Datasheet" wrote in message
link.net...
If you have no other choices at a lower alphabetical order than "All" you

just
need to sort ascending. If you have lower level choices, use "All".

Special
characters sort lower than alpha characters so "All" will appear first

sorted
ascending.

Steve
PC Datasheet





  #7  
Old July 8th, 2004, 03:34 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default Adding an extra choice to a ListBox

I usually add a DisplayOrder column, and set the *All* column's DisplayOrder
= 0, then order the whole recordset on DisplayOrder.

SELECT Field1, Field2, 1 As DisplayOrder FROM tblMyTable
UNION SELECT "-- All --" As Field1, "" As Field2, 0 As DisplayOrder
FROM MSysObjects WHERE [Name] = "MSysDb"
ORDER BY DisplayOrder

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyT...764559036.html


"PC Datasheet" wrote in message
link.net...
If you have no other choices at a lower alphabetical order than "All" you

just
need to sort ascending. If you have lower level choices, use "All".

Special
characters sort lower than alpha characters so "All" will appear first

sorted
ascending.

Steve
PC Datasheet

"April Marano" wrote in message
...
Great, that makes sense. Now how do I sort this new query in such a way
that "All" appears as the first row?

April

Make an Union Query out of your query and another query that returns

the
word
"All". Look in the Help file to create the correct query containing

"All".








  #8  
Old July 8th, 2004, 05:51 PM
PC Datasheet
external usenet poster
 
Posts: n/a
Default Adding an extra choice to a ListBox

Graham,

I don't think you really need to add the DisplayOrder field. The two dashes in
front of "All" should make it first in the sort order unless you have other
selections beginning with special characters. If you try it, let me know.

Steve
PC Datasheet

"Graham R Seach" wrote in message
...
I usually add a DisplayOrder column, and set the *All* column's DisplayOrder
= 0, then order the whole recordset on DisplayOrder.

SELECT Field1, Field2, 1 As DisplayOrder FROM tblMyTable
UNION SELECT "-- All --" As Field1, "" As Field2, 0 As DisplayOrder
FROM MSysObjects WHERE [Name] = "MSysDb"
ORDER BY DisplayOrder

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyT...764559036.html


"PC Datasheet" wrote in message
link.net...
If you have no other choices at a lower alphabetical order than "All" you

just
need to sort ascending. If you have lower level choices, use "All".

Special
characters sort lower than alpha characters so "All" will appear first

sorted
ascending.

Steve
PC Datasheet

"April Marano" wrote in message
...
Great, that makes sense. Now how do I sort this new query in such a way
that "All" appears as the first row?

April

Make an Union Query out of your query and another query that returns

the
word
"All". Look in the Help file to create the correct query containing

"All".










 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding an extra choice to a ListBox April Marano New Users 7 July 8th, 2004 05:51 PM
Adding my own button to the toolbar Steve Rindsberg Powerpoint 4 June 22nd, 2004 08:27 PM
Adding auto-numbered field screws up Table order Carl Database Design 5 May 30th, 2004 03:25 AM
manually adding a row to a ListBox Lexta New Users 2 May 28th, 2004 02:18 AM
Newbie Question on Extra Space After Numeric Values Yellowbird Worksheet Functions 3 March 8th, 2004 05:40 PM


All times are GMT +1. The time now is 06:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.