Solved

variance in access filter

Posted on 2016-11-02
3
35 Views
Last Modified: 2016-11-02
I am in vba and I am trying to get access to filter 5 either side of the cc so if subform value is 2400 the filter will allow 2395 to 2405

I thought this would do it

Me.QryNonSMMTData_subform.Form.Filter = "CC= >=Me.CC.Value - 5 and <= Me.CC.Value + 5"
0
Comment
Question by:PeterBaileyUk
3 Comments
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 41870068
Hi,

pls try

Me.QryNonSMMTData_subform.Form.Filter = "CC >=Me.CC.Value - 5 and CC <=Me.CC.Value + 5" 

Open in new window

Regards
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 41870079
is the reference to Me.CC.Value an unbound control on the form or is it the value of the [CC] field in the currently selected record?

You might try:

me.qryNonSMMTData_subform.Form.Filter = "([CC] >= " & (me.CC - 5) & ") AND ([CC] <= " & (me.CC + 5) & ")"
me.qryNonSMMTData_subform.Form.FilterOn = true
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 41870153
thank you
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question