Passing multiple parms to proc/func

Posted on 2011-10-13
Last Modified: 2012-05-12
I’ve forgotten the syntax for sending multiple parameters to a proc/func ?

For example you could call my SaveData proc in any of these ways:

SaveData(Data1, Data2)
SaveData(Data1, Data2, Data3 ……, etc …. etc, etc…..)
SaveData(Data1, Data2, Data3 ……, etc …. etc, etc….., etc …. etc, …..)

(And I don’t mean passing an array or overloading)

Cant remember the code syntact whan creating the proc/func !!!??!?
Tried googling but its one of them days … :(

Thanks in advance,
Question by:Kinger247
    LVL 8

    Expert Comment

    Hi Kinger247,
    when you declare your sub/function, use 'Optional' keywork before parameter.
    e.g. Public sub SaveData(Param1 as int, Optional Param2 as int, Optional Param3 as int)
    LVL 10

    Author Comment

    but that means you have to specify all the parameters in your function.
    There's a way of doing this withought knowing how many are being passed.
    So you could pass 1 paramerter or 1000.
    LVL 10

    Author Comment

    its kind of like specifing an array of parameters ...

    LVL 69

    Accepted Solution

    LVL 10

    Author Closing Comment

    Thats it, thankyou ..
    I'm really having one of those dumb days today.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now