Solved

access function - choking on syntax

Posted on 2013-12-28
2
499 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

710 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