B
banem2
I cannot find similar answer...
I am interested for correct syntax to filter query by VBA function.
Query filter: Between [Table1].[ID1]+1 And [Table1].[ID1]+4
When I use function this way:
Query filter: fGetFilter([Table1].[ID1])
Function fGetFilter (intID As Integer)
fGetFilter = "Between " & intID+1 & " And " & intID+4
End Function
Or
Function fGetFilter (intID As Integer)
fGetFilter = "Between [t_properties].[group]+ " & 1 & _
" And [t_properties].[group] +" & 4
End Function
This does not work. How to properly use Between in function to filter
query?
--
This approach needs to be used as ID's wraps. I have 2 fields with
numbers 1-9. Second field is filtered by first field value. If first
field has value of 7, second field filter needs to show data where
second field = 8 or 9 or 1 or 2. It goes to first field +4, but wrap
at 9 back to 1.
So my idea is to write function which will return proper filter, ie.
Function fGetFilter (intID as Integer)
Select Case intID
Case 8
fGetFilter = "Like 9 or Like 1 or Like 2 or Like 3"
End Select
End Function
I know it cannot work this way, but this is just to give an idea. Any
simple solution?
I am interested for correct syntax to filter query by VBA function.
Query filter: Between [Table1].[ID1]+1 And [Table1].[ID1]+4
When I use function this way:
Query filter: fGetFilter([Table1].[ID1])
Function fGetFilter (intID As Integer)
fGetFilter = "Between " & intID+1 & " And " & intID+4
End Function
Or
Function fGetFilter (intID As Integer)
fGetFilter = "Between [t_properties].[group]+ " & 1 & _
" And [t_properties].[group] +" & 4
End Function
This does not work. How to properly use Between in function to filter
query?
--
This approach needs to be used as ID's wraps. I have 2 fields with
numbers 1-9. Second field is filtered by first field value. If first
field has value of 7, second field filter needs to show data where
second field = 8 or 9 or 1 or 2. It goes to first field +4, but wrap
at 9 back to 1.
So my idea is to write function which will return proper filter, ie.
Function fGetFilter (intID as Integer)
Select Case intID
Case 8
fGetFilter = "Like 9 or Like 1 or Like 2 or Like 3"
End Select
End Function
I know it cannot work this way, but this is just to give an idea. Any
simple solution?