I have a following code:
Dim IDfiltr As Long
IDfiltr = Forms!KONTROLA!ID_OS
DoCmd.OpenForm "OSOBA", acNormal, "", "", , acNormal
Forms!OSOBA.FilterOn = False
DoCmd.ApplyFilter "", "[Forms]![OSOBA]![ID_OS] Like " & IDfiltr
In the last line, I am trying to substitute the VBA variable IDfiltr into the expression of the DoCmd.ApplyFilter, but it doesn't work. I was also trying this:
DoCmd.ApplyFilter "", "[Forms]![OSOBA]![ID_OS] Like IDfiltr"
But it also doesn't work. How can I substitute the VB variable IDfiltr into the expression?
Msgbox IDfiltrand tell the result ?[Forms]in the command. The right code isDoCmd.ApplyFilter "", "[OSOBA]![ID_OS] Like " & IDfiltr