473,416 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

"Show All" in combo box not working

I use a combo box to filter the results of a form.

Sql for combo box is...
SELECT StatusPriority, Status FROM tblStatus UNION Select = 0 as AllChoice,
"Show All" as Bogus From tblStatus ORDER BY StatusPriority;

AfterUpdate code from combo box is...
If Me![Status] = 0 Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[Status]='" & [StatusFilterCombo] & "'"
End If

All of the normal entries for the combo work fine in filtering the results
but when I select "Show All" no records show up. It is as though access
skips the If part of the statement and goes right to the then, finds no
records with "0" in [Status]

I tried using null values instead... UNION Select Null as AllChoice and If
IsNull (Me![Status]) Then and had the same results.

What am I doing wrong?
Oct 23 '06 #1
3 2883
On Mon, 23 Oct 2006 01:28:04 GMT, "Jimmy" <no**@none.comwrote:

Don't guess what Access is doing. Put a breakpoint on the If line, and
step through the code.

Personally I would write:
Me.FilterOn = False

-Tom.

>I use a combo box to filter the results of a form.

Sql for combo box is...
SELECT StatusPriority, Status FROM tblStatus UNION Select = 0 as AllChoice,
"Show All" as Bogus From tblStatus ORDER BY StatusPriority;

AfterUpdate code from combo box is...
If Me![Status] = 0 Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[Status]='" & [StatusFilterCombo] & "'"
End If

All of the normal entries for the combo work fine in filtering the results
but when I select "Show All" no records show up. It is as though access
skips the If part of the statement and goes right to the then, finds no
records with "0" in [Status]

I tried using null values instead... UNION Select Null as AllChoice and If
IsNull (Me![Status]) Then and had the same results.

What am I doing wrong?
Oct 23 '06 #2
Me.FilterOn=False did nothing by simply replacing it for the
DoCmd.ApplyFilter line. No surprise there.

As for the breakpoints, Access is certainly not doing what I expected.
Whenever I make a selection in the combo box with a breakpoint on the if
line, Me![Status] Access shows its value as being whatever the last
successful value was. For example, if, without using the breakpoint I open
the form and select "Completed" from the list, which has an id number of 4,
Access shows Me!Status = 4. When I continue in the code I get an error
(2488) that I cant use applyfilter in this window. That doesn't make sense
since without the breakpoint the filters work fine.

If for instance, I remove the breakpoint and run the form. In the combo box
I select "Show All". All of the records disapear from the form. I go to the
code window and insert breakpoint on the if line and go back to the form and
attempt to select anything from the combo box, when I am taken back to the
code Me!Status = Null !!! What gives.
Don't guess what Access is doing. Put a breakpoint on the If line, and
step through the code.

Personally I would write:
Me.FilterOn = False

-Tom.

Oct 23 '06 #3
How about

If Me![StatusFilterCombo] = 0 ?

Richard Bernstein

Jimmy wrote:
I use a combo box to filter the results of a form.

Sql for combo box is...
SELECT StatusPriority, Status FROM tblStatus UNION Select = 0 as AllChoice,
"Show All" as Bogus From tblStatus ORDER BY StatusPriority;

AfterUpdate code from combo box is...
If Me![Status] = 0 Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[Status]='" & [StatusFilterCombo] & "'"
End If
<snipped>
What am I doing wrong?
Oct 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Loreen | last post by:
I have been going through user groups and forums for the past 3 hours trying to figure out how to add "all" to my combo boxes. I've got two unbound comboboxes. Once only has one field...
3
by: tobhamlet | last post by:
If one is using a query as a Row Source on a Form, is there a way to set up a blank space, or to insert the word "ALL" in a combo box that represents ALL combo box row items. The scenario is as...
0
by: Greg Strong | last post by:
Hello All, In the past I've used a combo box with the 'row source' being an Access SQL union query to select "All" or 1 for only 1 criteria in a query. An example is as follows: SELECT 0 As...
4
by: meganrobertson22 | last post by:
Hi Everyone- I have a question about how to add and then use the "All" selection in a combo box. I am trying to figure out how to: (1) add "All" as a selection to a combo box and then (2)...
3
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a...
3
Zwoker
by: Zwoker | last post by:
Hi Everyone, I have a query that uses criteria from combo boxes in the form that runs it. When I had only discrete values in the combo boxes that matched the data that was being queried, the...
1
by: ewpos | last post by:
I have created a form that uses linked combo boxes to filter the results. When the filter runs, all of the text boxes in the form become populated with "#Name?". The record counter at the bottom...
5
by: tombev | last post by:
How do I add "ALL" (as the top choicce) in a drop down combo box in Access? (combo box only has one field)
1
by: StuartD | last post by:
I have a sub form that is populated based on the selection of a year from a combo box on the main form. I'm trying to add a second main form combo box for item category to further filter the sub...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.