Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

access function - choking on syntax

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

722 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