Solved

access function - choking on syntax

Posted on 2013-12-28
2
497 Views
Last Modified: 2013-12-28
Dear experts -
I have a function, but it's choking on the very first line of the declaration:

Public Function salesvalue(sortstatus As String, optional Milestone_ID As Integer, periodtype As String, whichperiod As Integer, includeprior As Boolean, TotalEstValue As Double, optional QuoteAmnt As Double, StartDate As Date, optional ExpDate As Date, optional EstDuration As Integer, weighted As Boolean, optional Probability As Double) As Double

The error message I get is: "syntax error"; it also shows "expected: Optional" if I try to edit it.

Any ideas?

Thanks -
0
Comment
Question by:terpsichore
2 Comments
 
LVL 13

Accepted Solution

by:
Carl Bohman earned 500 total points
ID: 39743954
As I recall, All optional parameters need to follow the required parameters.  Your second option (Milestone_ID) is marked as optional.  That means that everything that follows it needs to be optional as well.  However, several of the following options are not optional.

To fix, move all of your optional parameters to the end of the declaration.  This may require some changes on the lines where you are calling this function.  Just be sure to make the same changes in order.
0
 

Author Closing Comment

by:terpsichore
ID: 39743958
perfect - many thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

679 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