• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 502
  • Last Modified:

Access VBA - data in form using condition

Hi

I have an Access form that is bound to a table called "Tasks".
What VBA code would I use to filter the data so only records
where column "Project" equals "P1" are shown
0
Murray Brown
Asked:
Murray Brown
1 Solution
 
mbizupCommented:
Me.filter = "project ='p1'"
Me.filterOn = True
0
 
www_exacto_dkCommented:
Hi,

You can insert a button, e.g. called btn_filter and add the code below to the buttons 'On Click' event:

Private Sub btn_filter_Click()

Me.Filter = "Project = 'P1'"
Me.FilterOn = True

End Sub

Note that the criteria has ' ' around it, since it is a string. If it is a numerical value no ' ' needs to be around it. If it is a date criteria you put # # around it.

Brg

Martin
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now