Results 1 to 4 of 4
  1. #1
    canfish is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    25

    Skipping optional arguments

    Hi everybody,



    I have two questions.

    First, if I am working with a large function that has 5 arguments, and the 3 arguments in between are optional, how do I "skip" those arguments and only input information about the 5th argument? I am using Allen Browne's concatenate in one field function, and I want to change the string separator, but I can't do that without skipping the arguments in between.

    Second, once I figure out how to do that, how do I insert a line break into the argument? I want to concatenate my fields in one function with line breaks instead of commas, so that it is kind of like I have a bullet point list (but without the bullets). Is there a symbol for this, or is there some other method?

    Thanks very much!

    -canfish

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    There's a pretty decent discussion of how to use optional arguments in VBA help, titled "Understanding named and optional arguments". It also demonstrates adding a line continuation characters (space-underscore) into the declaration.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    canfish is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    25
    Thanks pbaldy!

    Do you have any idea how to find out what the default values are for each argument? I found that I couldn't leave the optional arguments blank, but I had to put the default code in for Access to accept it. How do I find this default code?

    Also, does anyone have some idea how to insert a line break into an argument?

    Thanks!

    canfish

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Did you read the help article? You don't have to provide optional arguments, and the line break is demonstrated:

    Sub OptionalArgs(strState As String, Optional varRegion As Variant, _ Optional varCountry As Variant = "USA")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 07-01-2010, 02:53 PM
  2. Replies: 2
    Last Post: 06-23-2010, 06:37 PM
  3. Skipping Fields in forms
    By who in forum Forms
    Replies: 1
    Last Post: 06-17-2009, 12:01 PM
  4. Open form arguments
    By nkenney in forum Forms
    Replies: 4
    Last Post: 04-10-2009, 08:40 PM
  5. OpenForm Action and Arguments
    By nkenney in forum Forms
    Replies: 9
    Last Post: 04-05-2009, 09:33 AM

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