Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

access function - choking on syntax

Posted on 2013-12-28
2
Medium Priority
?
505 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 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

885 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