Results 1 to 8 of 8
  1. #1
    MikhaR is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    3

    Using structured function (with dot(.)) in a query returns error

    Running a query using a structured function in criteria, for example

    =CustomFunction(a,b,c).Type1

    Returns an error: "The expression you have entered has an invalid . (dot) or ! operator or invalid parenthesis"


    The function works well in VBA.

    Does anyone knows any workaround?
    Much thanks

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    8,757
    If you want to call a custom function in a query it is either FunctionNameHere() if it takes no parameters, or FunctionNameHere(param1,param2...)
    The only time I can think of that a dot would come in to play is if the function is located in another database.

    If a function defined as Myfunction(a,b,c).Type1 would actually work I'd be interested in learning how. Not saying it's impossible, just not understanding how it could be.
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

  3. #3
    MikhaR is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    3
    Quote Originally Posted by Micron View Post
    If you want to call a custom function in a query it is either FunctionNameHere() if it takes no parameters, or FunctionNameHere(param1,param2...)
    The only time I can think of that a dot would come in to play is if the function is located in another database.

    If a function defined as Myfunction(a,b,c).Type1 would actually work I'd be interested in learning how. Not saying it's impossible, just not understanding how it could be.

    If the function is of a custom Type it will have a dot - function(par1,par2).answer1 - for example

  4. #4
    Welshgasman is online now Expert
    Windows 10 Access 2007
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    660
    Please, please use # when posting code snippets.
    Cross Posting Etiquette: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?search_query=debug+access+vba



  5. #5
    MikhaR is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    3
    Quote Originally Posted by Welshgasman View Post

    I didn't know the forums are related.

    It doesn't seem that anyone knows how to solve this, or interested enough to have the patience to understand the issue

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    841
    Quote Originally Posted by MikhaR View Post
    I didn't know the forums are related.

    It doesn't seem that anyone knows how to solve this, or interested enough to have the patience to understand the issue
    The forums are not related, but many of us, including Gasman, Micron, and myself, belong to several of them.

    It looks like it was answered in the other thread so engaging here is a little pointless. That's one of the drawbacks of cross-posting.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #7
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    8,757
    If the function is of a custom Type it will have a dot - function(par1,par2).answer1 - for example
    Basically repeating what you've already said doesn't enlighten anyone, really. I've written thousands of udf (user defined function) - what you seem to be calling a custom function, and have never used a trailing dot syntax. You should read this too for some insight.

    https://www.excelguru.ca/content.php?184

    EDIT - so I followed that link. For some reason you posted there 1.5 hours later and explained you're trying to pass the return value of a function as part of the function call. Too bad you didn't give us the same info, but I see that you have your answer now.

    This is nonsense
    It doesn't seem that anyone knows how to solve this, or interested enough to have the patience to understand the issue
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    15,505
    MikhaR,


    Please show us some/any documentation or support materials for
    If the function is of a custom Type it will have a dot - function(par1,par2).answer1 - for example
    And an example to support your claim
    The function works well in VBA.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 08-20-2018, 11:49 AM
  2. Replies: 14
    Last Post: 03-31-2015, 05:20 PM
  3. User Defined Function Returns Ambiguous Name Error
    By HotsauceHero in forum Modules
    Replies: 8
    Last Post: 10-03-2014, 04:09 PM
  4. Val function returns #error on text/percentage
    By allenjasonbrown@gmail.com in forum Queries
    Replies: 1
    Last Post: 06-23-2013, 08:24 AM
  5. Replies: 6
    Last Post: 01-07-2011, 12:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums