Im trying to apply filter for a table, the filter will be after the date #01-01-2022# tan later I will export but when i tried to run the code doesn work. Any help pls
Function Filter()
DoCmd.OpenTable "RF", acViewNormal, acEdit
DoCmd.ApplyFilter Format("[Fecha envío]", "dd-mm-yyyy") & "<#" & Format(1 - 1 - 2022, "dd-mm-yyyy") & "#"
End Function
---Edit----
This is the example of the table i want to apply the filter
Fecha envío (d-m-yyyy) |
---|
05-02-2018 |
01-04-2021 |
31-03-2022 |
23-03-2022 |
After some comments I did some modification to the code
DoCmd.ApplyFilter Format([Fecha envío], "d-m-yyyy") > Format(#1/1/2022#, "d-m-yyyy")
2cond Edit
I solved thw filter with the following code
DoCmd.ApplyFilter , "[Fecha envío]>=#" & Format(#1/1/2022#, "d-m-yyyy") & "#"
CodePudding user response:
This is the code to use for a fixed date:
DoCmd.ApplyFilter "[Fecha envío] < DateSerial(2022, 1, 1)"
CodePudding user response:
This code work for me
DoCmd.ApplyFilter , "[Fecha envío]>=#" & Format(#1/1/2022#, "d-m-yyyy") & "#"