Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2002
    Posts
    13

    Question Unanswered: Undefined Function

    Hey All...

    I have created a function flag to do a simple operation.

    Option Compare Database

    Public Function Flag(A, B)
    if (A / B) >1 Then
    Flag = 1
    Else
    Flag = (A / B)
    End If
    End Function

    When I call this in a query:
    testflag: flag([month1], [month2])

    I get an undefined function error. I have attempted to this by using the expression builder, and choosing functions, and I still get the error...

    I have even tried to do the same using simple examples out of some VBA refrence books, and I'm getting the same "Undefined Function" error.

    And YES... this is a Module, not a class module or anything else. I have also attempted to compile the function before using it, but to no avail.

    Is there something that I am missing??

    PLEASE HELP!

    Greg
    Gregorio E. Gonzalez

  2. #2
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Any possibility you have two public functions called flag? or that flag is reserved for something? A simple test would be to rename it to gFlag().
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  3. #3
    Join Date
    Jul 2002
    Location
    Eastbourne, UK
    Posts
    9
    Flag is a reserved word in VBA. Chances are that using this in a function will confuse Access.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •