Link to home
Start Free TrialLog in
Avatar of wiswalld
wiswalldFlag for United States of America

asked on

Apply filter to a form

I want to open a form and filter the records only to shows the records where Me.CheckCheckbox = False
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

What king of record in what object (datagridview, listview, ...) ?

If you retrieve information from an database you can use something like "SELECT * FROM myTable WHERE active = " & Me.CheckBox1.Ckecked

Can you tell us more ?

jpaulino
... being a master in access databases you should know that! :-)

Post more information.
Avatar of wiswalld

ASKER

In the query designed in VB.Net I tried this but I keep getting errors. If I take away the where part it works.

SELECT     AutoNumber, [Check], [Date], [Time], BOLO
FROM         message
WHERE     ([Check] = [false])


I cannot figure out this VB
So I was figuring on just adding a filter to the binding source.
=)

right, access, probably...
probably where something in some records equals to some checkbox value on the form or something... I have a great 6th sense! =)

wiswalld:

"....... where myField = " & Me.CheckCheckbox = False



You can get the information from the SQL directly, like the example I post already.

Show us more code ...
ASKER CERTIFIED SOLUTION
Avatar of MrRobot
MrRobot
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
so you can use

"SELECT     AutoNumber, [Check], [Date], [Time], BOLO FROM         message WHERE     ([Check] = " & Math.Abs(CInt(chkMyBox.Checked)) & ")"

That did it. Thanks.


JPaulino maybe I should stick to access. I hate trying to learn new things :-)

or

"SELECT AutoNumber, [Check], [Date], [Time], BOLO FROM message WHERE [Check] = " & IIf(chkMyBox.Checked, "1", "0")
Thank. I can't believe I couldn't figure that out.

Dave
wiswalld,

I do all my project (VB or ASP) in SQL. I don't use access anymore. Just for small things.

You didn't told us if you use SQL, Access, MySql, etc. I just asked for more information.

Good luck
Sorry.


Note to self (explain more)
>> I hate trying to learn new things

You must always learn new thing if you really like development!

I love to learn and SQL is very used in the industry.
Don't try to confuse me. I am just learning with access. SQL will only screw me up.