Access - Function

Solved
Hello,
Windows XP – Access 2000.
I created a function to filter records. When I activate the function, I get the following message: "the entered expression contains an unrecognized function name." When I open the function to edit it, I notice that the setting in the top right is "(Declarations)" and the name is "F_Filtrer" (that's the name given to the function). If I select "F_Filtrer" and save it, as soon as I use it, the setting deactivates and reverts back to "(Declarations)." It’s worth noting that the function worked correctly 2 or 3 times. I don’t understand.
Thank you for your responses
Configuration: Windows XP Access 2000

5 answers

  1. Hello,
    The lists you're talking about simply indicate which section of code your cursor is in ("Declarations" when the cursor is at the beginning of the module...).
    Is this F_Filtrer function called by a button?
    0
    1. Thank you for the response
      - ok for the cursor position
      - from a button placed on the form, I activate a macro to
      a) Open Form
      b) ExecuteCode ... Function name: F_Filtrer()
      The most surprising thing is that the command worked 3 or 4 times!!!
      0
  2. D'accord, je comprends que tu souhaites voir le code, mais je ne peux pas fournir cela.
    0
    1. Here is the code:

      Function F_Filtrer()
      Filtre1 = "[Lettre] Like ""*"" & forms![F_Fiche_Selection].[CXPROP] & ""*"""
      Filtre2 = "[Entreprise] Like ""*"" & forms![F_Fiche_Selection].[CXENTMAT] & ""*"""
      Filtre3 = "[Designation] Like ""*"" & forms![F_Fiche_Selection].[CXDES] & ""*"""
      DoCmd.OpenForm "F_Fiche_Selection_Resultat", acNormal, "", Filtre1 & " And " & Filtre2 & " And " & Filtre3, , acNormal
      End Function
      0
  3. Oki, we can start with the syntax:

    Filter1 = "[Letter] Like ""*"" & forms![F_Fiche_Selection].[CXPROP] & ""*"""

    Filter1 = "[Letter] Like '*" & forms![F_Fiche_Selection].[CXPROP] & "*'"
    ==> [Letter] Like '*VALUE*'

    Which line gives you an error?
    0
    1. I don't have any line error message. When I activate the function through the macro, I get the following message: "the entered expression contains an unrecognized function name."
      0
  4. Re,
    Ok, are there any filter data in your records for characters ' or " by any chance?
    0
    1. Hello,

      ... I just found ...

      in the mode, in the left window, at the top, I had:

      (name) ... F_Filter

      I modified

      (name) ... F_Filter()

      ... and it works.

      And thank you very much for your help. Thank you
      0
  5. ah ok, well I wasn't into it at all there :)
    0