Names of properties in custom classes

Posted on 2002-06-26
Medium Priority
Last Modified: 2013-11-23
I'd like to define a property named Date in a class that I am writing.

But, when I input the following property definition
    Public Property Get Date() As Date
    End Property

I get:

    Compile Error
    Expected: identifier

I'm assuming that this has something to do with the built in Date object.  Is there any way to get around this?
Question by:derekl
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
LVL 28

Accepted Solution

AzraSound earned 150 total points
ID: 7111189
Yes it is due to the intrinsic Date function.  You need to change the property name.  If it is a specific date, give it more meaning, e.g. LoginDate, DateSubmitted, InvoiceDate, etc.
LVL 22

Expert Comment

ID: 7111297
You can try to suffix it with an underscore.  Not exactly what you want, but reasonably close.

Public Property Get Date_() As Variant

End Property

Public Property Let Date_(ByVal vNewValue As Variant)

End Property
LVL 16

Expert Comment

ID: 7111318
Keywords cannot be used as name for variables, constants, properties like any other language (as long as i know).
Industry Leaders: 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!

LVL 70

Expert Comment

by:Éric Moreau
ID: 7111644
Try this:

Public Property Get [Date]() As Date

Author Comment

ID: 7112547
Public Property Get[Date]() As Date did not work.
LVL 16

Expert Comment

ID: 7113583
what about Azra and rspahitz comments?
LVL 22

Expert Comment

ID: 7114017
Personally, I think Azra's comment makes the most sense (in addition to answering the Q!) since the date will most likely not be "generic" but will be related to something.
LVL 16

Expert Comment

ID: 7180859
Why "B" grade? what were you waiting for?

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

762 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