Hide records in a dropdown list

  • Thread starter Nate via AccessMonster.com
  • Start date
N

Nate via AccessMonster.com

Hello All

I have searched the posts and have found a few referenced to my question, but
nothing specific.

I have a dropdown list on a form that contains old records. I would like to
hide these records from displaying in my dropdown list, so the user cannot
choose them or even view them. I thought the best way to elimate these
records would be to add a checkbox (yes/no) field to my table and then try to
get Access only to pull up those records that are not checked. The record
source for my dropdown list is based on a query so it can be sorted properly.


Is there a way to add some code to the query that sorts the data in my
dropdown list so that it only displays the records without a checked box? Or
is there a better way to go about this? I am not too good a writing my own
code, so please be specific.

Thanks Much
Nate
 
K

KARL DEWEY

The record source for my dropdown list is based on a query so it can be
sorted properly.Edit the query SQL to add a WHERE statement.
WHERE [CheckedBoxField] = 0
Because [CheckedBoxField] is not in the SELECT part of the SQL it will not
show in your list.

If your table for the query for the listbox looks like this -
1 Brown
2 Blue
3 Gray
4 Black
and your bound field is 1, you will need to do a little
more or your records that used the list items that are old will not display.
My solution to the problem was to format checkbox as 'Active' & 'Inactive'.
I added two sorts to the query -- checkbox then display data so that
inactive items were after all the active items.
 
N

nathank via AccessMonster.com

Thanks, after a little tweaking that worked just fine. Perfect!!

KARL said:
Edit the query SQL to add a WHERE statement.
WHERE [CheckedBoxField] = 0
Because [CheckedBoxField] is not in the SELECT part of the SQL it will not
show in your list.

If your table for the query for the listbox looks like this -
1 Brown
2 Blue
3 Gray
4 Black
and your bound field is 1, you will need to do a little
more or your records that used the list items that are old will not display.
My solution to the problem was to format checkbox as 'Active' & 'Inactive'.
I added two sorts to the query -- checkbox then display data so that
inactive items were after all the active items.
Hello All
[quoted text clipped - 15 lines]
Thanks Much
Nate
 
N

nate via AccessMonster.com

Thanks, after a little tweaking that worked just fine. Perfect!!

KARL said:
Edit the query SQL to add a WHERE statement.
WHERE [CheckedBoxField] = 0
Because [CheckedBoxField] is not in the SELECT part of the SQL it will not
show in your list.

If your table for the query for the listbox looks like this -
1 Brown
2 Blue
3 Gray
4 Black
and your bound field is 1, you will need to do a little
more or your records that used the list items that are old will not display.
My solution to the problem was to format checkbox as 'Active' & 'Inactive'.
I added two sorts to the query -- checkbox then display data so that
inactive items were after all the active items.
Hello All
[quoted text clipped - 15 lines]
Thanks Much
Nate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top