Filter for Instock Yes/No

C

CJ

Hi Groupies

My Access 2003 database keeps track of equipment. My form lists all of the
equipment and a checkbox shows whether it is In Stock (available to be sold)
or Not In Stock (sold but still on site or gone).

I want to be able make it easy for them to filter the In Stock items by
using a combo or a button. The query behind the form is a left outer join so
it returns all of the equipment by default.

I tried using a check box on the form and then having the data source use
that as a parameter criteria but I can not get the form to update, no data
is ever returned. This method works with a duplicate query but not the forms
data source.

I'm not sure of the best way to do this. Could somebody please help me out
here?
 
C

CJ

Never mind. I figured out my problem right after I hit Send ;-)

Just a typo...... sheesh
 
K

Klatuu

In this case, I would suggest an Option Group with 3 buttons:

All
In Stock
Not In Stock

Then rather than filter the form's record source, use the form's filter and
set the filter in the After Update event of the option group.

Private Sub opgFilter()

With Me
Select Case .optFilter
Case 1
.FilterOn = False
Case 2
.Filter = [InStock] = True
.FilterOn = True
Case 3
.Filter = [InStock] = False
.FilterOn = True
End Select
End With
End Sub
 
C

CJ

Well, that is a better option.

Thanks Dave!!

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Klatuu said:
In this case, I would suggest an Option Group with 3 buttons:

All
In Stock
Not In Stock

Then rather than filter the form's record source, use the form's filter
and
set the filter in the After Update event of the option group.

Private Sub opgFilter()

With Me
Select Case .optFilter
Case 1
.FilterOn = False
Case 2
.Filter = [InStock] = True
.FilterOn = True
Case 3
.Filter = [InStock] = False
.FilterOn = True
End Select
End With
End Sub
 
C

CJ

OK, minor hitch....I can't get it to work.

My Option Group is called opgFilter
Allow Filters is set to Yes on the Form

I have the following code:
Private Sub opgFilter_AfterUpdate()
With Me
Select Case .opgFilter
Case 1
.FilterOn = False
Case 2
.Filter = [InStock] = True
.FilterOn = True
Case 3
.Filter = [InStock] = False
.FilterOn = True
End Select
End With
End Sub

I can not change anything in the Option Group.

Any ideas?
--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
CJ said:
Well, that is a better option.

Thanks Dave!!

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Klatuu said:
In this case, I would suggest an Option Group with 3 buttons:

All
In Stock
Not In Stock

Then rather than filter the form's record source, use the form's filter
and
set the filter in the After Update event of the option group.

Private Sub opgFilter()

With Me
Select Case .optFilter
Case 1
.FilterOn = False
Case 2
.Filter = [InStock] = True
.FilterOn = True
Case 3
.Filter = [InStock] = False
.FilterOn = True
End Select
End With
End Sub
 
M

Marshall Barton

CJ said:
OK, minor hitch....I can't get it to work.

My Option Group is called opgFilter
Allow Filters is set to Yes on the Form

I have the following code:
Private Sub opgFilter_AfterUpdate()
With Me
Select Case .opgFilter
Case 1
.FilterOn = False
Case 2
.Filter = [InStock] = True
.FilterOn = True
Case 3
.Filter = [InStock] = False
.FilterOn = True
End Select
End With
End Sub

I can not change anything in the Option Group.


The Filter property is a string so it needs to be in quotes:

.Filter = "InStock = False"
 
C

CJ

That did it!

Very slick. Thanks very much guys!

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Marshall Barton said:
CJ said:
OK, minor hitch....I can't get it to work.

My Option Group is called opgFilter
Allow Filters is set to Yes on the Form

I have the following code:
Private Sub opgFilter_AfterUpdate()
With Me
Select Case .opgFilter
Case 1
.FilterOn = False
Case 2
.Filter = [InStock] = True
.FilterOn = True
Case 3
.Filter = [InStock] = False
.FilterOn = True
End Select
End With
End Sub

I can not change anything in the Option Group.


The Filter property is a string so it needs to be in quotes:

.Filter = "InStock = False"
 

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