Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2010
    Posts
    11

    Question Unanswered: function has the wrong number of arguments

    Hi,

    I am trying to create an append query using the following expression:
    FName: Mid$([Name],1,[InStr([1],[Name]," ")])

    This query is supposed to return the first string of characters from a field called "Name", up until there is a space in the field titled "Name." The query will then append this value to the field called "FName" (First Name) in another table.

    I keep receiving the error, "The expression you entered has a function containing the wrong number of arguments." Can you help me figure out what is wrong?

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I see two problems.

    First, you're using Name as a field name, which is a big nono! Name is a Reserved Word in Access, and using it in this way is going to cause problems, sooner or later.

    Secondly, you have a number of incorrect Square Brackets [].

    Mid$([Name],1,[InStr([1],[Name]," ")])

    Access uses Square Brackets to denote Field Names, and when it can't find a Field with that name, such as the 1 in [1] it pops an error.

    So change your Name field name to something else, such as NName, and

    Mid$([NName], 1, InStr(1, [NName], " "))

    will work.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Dec 2010
    Posts
    11
    Ah, yes. I see I did put in too many brackets. Your code worked like a charm. Many thanks!

    FName: Mid$([FullName],1,InStr(1,[FullName]," "))
    Last edited by adevries; 12-14-10 at 17:04.

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad we could help!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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