473,395 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Class or Function that lists options

We are wondering if there is a way to write a function, or perhaps a
class, that can do the following. When you start to type a built-in
Access function, when you start to type the function, you are prompted
for each parameter that needs to be passed. Often, you get a list of
choices (acPreview, acNormal etc.). Can we create this type of thing
in our own user defined functions? I know a class will show the
properties available in the class, but what we want to do seems to be
another level of choices.

For example, we found and worked with the class below. Now, lets say
the user starts to type CalculateSunrise.city. We'd like him to see
the list of available cities. Of course, we can do this on a form with
combo boxes but is there a way we can make it part of the class?
' ------ Class clsSunRiseSet
' Version 2.01
Option Explicit
Public frm As Form
' -- The following properties are exposed:
'Sunrise (r) - Sunrise time
'Sunset (r) - Sunset time
'SolarNoon (r) - Solar noon
'
'CityCount (r) - Number of cities
'CityName (r) - Name of city, by index
'City (w) - Sets the longitude/latitude/timezone based off a city
' name or city index
'TimeZone (r/w) - Current Timezone
'DaySavings (r/w) - Daylight savings time in effect
'Longitude (r/w) - Longitude to calculate for
'Latitude (r/w) - Latitude to calculate for
''DateDay (r/w) - Date to calculate for
''
' -- The following method is exposed
'CalculateSun - Calculate sunrise, sunset and solar noon
'
' Scott Seligman
' http://www.scottandmichelle.net/scott/
' Based off of
' http://www.srrb.noaa.gov/highlights/sunrise/gen.html

Nov 13 '05 #1
8 1797
I believe what you are looking for is Enum. Read up on the Enum.

On 13 Dec 2004 20:51:59 -0800, "Penguin" <rh*********@yahoo.com> wrote:
We are wondering if there is a way to write a function, or perhaps a
class, that can do the following. When you start to type a built-in
Access function, when you start to type the function, you are prompted
for each parameter that needs to be passed. Often, you get a list of
choices (acPreview, acNormal etc.). Can we create this type of thing
in our own user defined functions? I know a class will show the
properties available in the class, but what we want to do seems to be
another level of choices.

For example, we found and worked with the class below. Now, lets say
the user starts to type CalculateSunrise.city. We'd like him to see
the list of available cities. Of course, we can do this on a form with
combo boxes but is there a way we can make it part of the class?
' ------ Class clsSunRiseSet
' Version 2.01
Option Explicit
Public frm As Form
' -- The following properties are exposed:
'Sunrise (r) - Sunrise time
'Sunset (r) - Sunset time
'SolarNoon (r) - Solar noon
'
'CityCount (r) - Number of cities
'CityName (r) - Name of city, by index
'City (w) - Sets the longitude/latitude/timezone based off a city
' name or city index
'TimeZone (r/w) - Current Timezone
'DaySavings (r/w) - Daylight savings time in effect
'Longitude (r/w) - Longitude to calculate for
'Latitude (r/w) - Latitude to calculate for
''DateDay (r/w) - Date to calculate for
''
' -- The following method is exposed
'CalculateSun - Calculate sunrise, sunset and solar noon
'
' Scott Seligman
' http://www.scottandmichelle.net/scott/
' Based off of
' http://www.srrb.noaa.gov/highlights/sunrise/gen.html


Nov 13 '05 #2
You are asking for an enumeration:

Enum MyList
dog = 1
cat = 2
End Enum
Public Function TestMyList(MyMember As MyList)
Debug.Print MyMember
End Function

BTW, you can also use the built-in enumerations, e.g.:
Dim Response As VbMsgBoxResult

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Penguin" <rh*********@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
We are wondering if there is a way to write a function, or perhaps a
class, that can do the following. When you start to type a built-in
Access function, when you start to type the function, you are prompted
for each parameter that needs to be passed. Often, you get a list of
choices (acPreview, acNormal etc.). Can we create this type of thing
in our own user defined functions? I know a class will show the
properties available in the class, but what we want to do seems to be
another level of choices.

For example, we found and worked with the class below. Now, lets say
the user starts to type CalculateSunrise.city. We'd like him to see
the list of available cities. Of course, we can do this on a form with
combo boxes but is there a way we can make it part of the class?
' ------ Class clsSunRiseSet
' Version 2.01
Option Explicit
Public frm As Form
' -- The following properties are exposed:
'Sunrise (r) - Sunrise time
'Sunset (r) - Sunset time
'SolarNoon (r) - Solar noon
'
'CityCount (r) - Number of cities
'CityName (r) - Name of city, by index
'City (w) - Sets the longitude/latitude/timezone based off a city
' name or city index
'TimeZone (r/w) - Current Timezone
'DaySavings (r/w) - Daylight savings time in effect
'Longitude (r/w) - Longitude to calculate for
'Latitude (r/w) - Latitude to calculate for
''DateDay (r/w) - Date to calculate for
''
' -- The following method is exposed
'CalculateSun - Calculate sunrise, sunset and solar noon
'
' Scott Seligman
' http://www.scottandmichelle.net/scott/
' Based off of
' http://www.srrb.noaa.gov/highlights/sunrise/gen.html

Nov 13 '05 #3
Thanks for your responses. Unfortunately, enum is not available in
Access 97. From various searches it would appear that one can declare
constants, but how can you get them to show up in intellisense?

I also tried to look at dim abc as combobox or as dropdown - but there
didn't seem to be much info. Would this help me?

Nov 13 '05 #4
On 16 Dec 2004 20:18:46 -0800, "Penguin" <rh*********@yahoo.com> wrote:
Thanks for your responses. Unfortunately, enum is not available in
Access 97. From various searches it would appear that one can declare
constants, but how can you get them to show up in intellisense?

I also tried to look at dim abc as combobox or as dropdown - but there
didn't seem to be much info. Would this help me?


You didn't say it was Access 97. I don't think yuo can do it without making
an ActiveX library on VB6.
Nov 13 '05 #5
Penguin wrote:
We are wondering if there is a way to write a function, or perhaps a
class, that can do the following. When you start to type a built-in
Access function, when you start to type the function, you are prompted
for each parameter that needs to be passed. Often, you get a list of
choices (acPreview, acNormal etc.). Can we create this type of thing
in our own user defined functions? I know a class will show the
properties available in the class, but what we want to do seems to be
another level of choices.

For example, we found and worked with the class below. Now, lets say
the user starts to type CalculateSunrise.city. We'd like him to see
the list of available cities. Of course, we can do this on a form with
combo boxes but is there a way we can make it part of the class?


No, there is no enum in A97.

I did this by creating public methods for every constant. It is not the
same as intellisense, as you still have to type the class name (using
the generic reference)

CalculateSunrise.city = clsSunRiseSet.

and a list of methods including the constants follows. You could even
have a separate class (possibly with a shorter name) containing just
those constants, exposed as methods.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #6
All I have is VB4 (and no help on it either!) I assume since you
mention VB6 that I can't do it in VB4?

Nov 13 '05 #7
On 17 Dec 2004 07:51:08 -0800, "Penguin" <rh*********@yahoo.com> wrote:
All I have is VB4 (and no help on it either!) I assume since you
mention VB6 that I can't do it in VB4?


That is correct. I think it might be possible in VB5, but I'm not certain.
Nov 13 '05 #8
I don't have VB4 to test, but Enum may have been introduced after that.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Penguin" <rh*********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
All I have is VB4 (and no help on it either!) I assume since you
mention VB6 that I can't do it in VB4?

Nov 13 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DaveLessnau | last post by:
In a book on Data Structures that I'm reading, the authors are describing various linked lists and trees. In these, they start with some form of node class. What's driving me crazy is that they...
3
by: Toboja | last post by:
Hello, I have two select lists: Available Sort Options and Selected Sort Options. The user clicks on any of the available sort options and can move them to the selected sort options box. I use...
2
by: BrianP | last post by:
Hi, I have had to invent a work-around to get past what looks like a JavaScript bug, the malfunctioning Perl-like JavaScript array functions including SPLICE() and UNSHIFT(). I have boiled it...
4
by: tascien | last post by:
Hi guys, I have a class object I want to expose in a webservice class... How can I make sure that all objects including subclasses are exposed in WSDL. here is an example: Public Class Lists '<...
2
by: Christian Chrismann | last post by:
Hi, an application uses a wrapper class for an STL list. Basically, this template class provides the same functions (delete, append, find...) as an ordinary STL list. Additionally, there are...
1
by: teofilo | last post by:
I built this class for simple text based menu, for using with other classes. #ifndef MENU_H #define MENU_H #include <string> using std::string; #include <vector> using std::vector;
1
by: David Lozzi | last post by:
Howdy, A little background, using asp.net 2.0, i'm using a wizard object to create a email interface for a user to email out their clientele, about 200 or so, depending on the selection. The...
3
by: Raman | last post by:
Hi All, Could any one tell what exactly these two option do. I have not been able to understand why we use them because as per the gcc man page, these options increase the size of libraries...
18
by: RB | last post by:
Hi guys (and gals!), I've got 2 classes, "TypesafeConstant" and "Color". "Color" inherits from "TypesafeConstant", and adds no new functionality. All "Color" does is to instantiate some class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.