apply drop down box to filter my data

S

souris

I would like have my app to apply a filter to my dropdown box value form
user entered?

My form has a dropdown box to let user select the status of like open,
close.
I just want filter data to the form only shows the data status follow the
dropdown box.
Any body has this feature before?
Can you please give me some example code?
Your help is great appreciated.

Souris,
 
R

Rick Brandt

souris said:
I would like have my app to apply a filter to my dropdown box value form user
entered?

My form has a dropdown box to let user select the status of like open, close.
I just want filter data to the form only shows the data status follow the
dropdown box.
Any body has this feature before?
Can you please give me some example code?
Your help is great appreciated.

Nope, you're the first one to think of this : -)

In the AfterUpdate of the ComboBox...

Me.Filter = "Status = ' " & Me.ComboBoxName & " ' "
Me.FilterOn = True

I used extra spaces in the above to make the quoting easier to see. You would
not include that spacing in your actual code.
 
S

souris

Thanks for the information,
I am the first one to think about this???
Is it a good design?
Will be table updatable?

Thanks again,

Souris,
 
S

souris

When I have the following code in my app.
It updates my record from Close to Open if I change the dropdown box value,
I must have a property to set update my field,but I could not figure out
which one.
Can you please help me to find which property needs to be change?
Your help is great appreciated.

Souris,
 
D

Douglas J. Steele

Rick was being facetious. Using a combobox in this way is very common.

Yes, the table will be updatable. Note, though, that if you change a row to
a different status, you will no longer see that row.
 
R

Rick Brandt

souris said:
When I have the following code in my app.
It updates my record from Close to Open if I change the dropdown box value,
I must have a property to set update my field,but I could not figure out which
one.
Can you please help me to find which property needs to be change?
Your help is great appreciated.

The ComboBox that you use to apply the filter should be unbound (no
ControlSource).
 
S

souris

I still missing something here.

My property of filter is [Call Type]='2'. I use a button to set filter on is
working to filter my record.

My code is following in AfterUpdate

Private Sub Combo6_AfterUpdate()
Me.Filter = "[Call Type] = '" & Me.Combo6 & "'"
Me.FilterOn = TRUE
End Sub

It still does not work.
Any comments?
Thanks again,

Souris,
 
S

souris

Thanks all of you.

It is working now,

Souris,

souris said:
I still missing something here.

My property of filter is [Call Type]='2'. I use a button to set filter on
is working to filter my record.

My code is following in AfterUpdate

Private Sub Combo6_AfterUpdate()
Me.Filter = "[Call Type] = '" & Me.Combo6 & "'"
Me.FilterOn = TRUE
End Sub

It still does not work.
Any comments?
Thanks again,

Souris,



Douglas J. Steele said:
Rick was being facetious. Using a combobox in this way is very common.

Yes, the table will be updatable. Note, though, that if you change a row
to a different status, you will no longer see that row.
 
R

Rick Brandt

souris said:
I still missing something here.

My property of filter is [Call Type]='2'. I use a button to set filter on is
working to filter my record.

My code is following in AfterUpdate

Private Sub Combo6_AfterUpdate()
Me.Filter = "[Call Type] = '" & Me.Combo6 & "'"
Me.FilterOn = TRUE
End Sub

It still does not work.
Any comments?

Is Call Type a numeric field or text? If a number you should eliminate the
quotes. Does Combo6 have only one column? You might be grabbing the wrong one
if it has multiple columns.
 

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