473,394 Members | 1,746 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,394 software developers and data experts.

looking for a tutorial or detailed infos on how to work with arrays??

5 1536
Arrays? For a database application?

What do you think you want to do with them?

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #2
Instead of using an array consider creating your own variable type:
VBA (Access 95 onwards) allows you to return an entire structure of values.
In database terms, this is analogous to returning an entire record rather
than a single field. For example, imagine an accounting database that needs
to summarize income by the categories Wages, Dividends, and Other. VBA
allows you to declare a user-defined type to handle this structure:

Public Type Income
Wages As Currency
Dividends As Currency
Other As Currency
Total As Currency
End TypeYou can now use this structure as the return type for a
function. In a real situation, the function would look up your database
tables to get the values, but the return values would be assigned like this:

Function GetIncome() As Income
GetIncome.Wages = 950
GetIncome.Dividends = 570
GetIncome.Other = 52
GetIncome.Total = GetIncome.Wages + GetIncome.Dividends +
GetIncome.Other
End FunctionTo use the function, you could type into the Immediate
Window:

? GetIncome().Wagesor you could include a text box on a report and set
its ControlSource property to:

= GetIncome().Total(Note: the use of "Public" in the Type declaration
gives it sufficient scope.)

Programmers with a background in C will instantly recognize the
possibilities now that user-defined types can be returned from functions. If
you're keen, user-defined types can even be based on other user-defined
types.
"Norman Fritag" <mt*****@ozemail.com.au> wrote in message
news:%w****************@nnrp1.ozemail.com.au...

Nov 12 '05 #3
r0adh0g wrote:
Instead of using an array consider creating your own variable type:
VBA (Access 95 onwards) allows you to return an entire structure of values. Programmers with a background in C will instantly recognize the
possibilities now that user-defined types can be returned from functions. If
you're keen, user-defined types can even be based on other user-defined
types.


Aha. And programmers with C++ knowledge may even creating Class modules,
extending the type with functions, procedures and properties.

That is definately true, but it depends quite a bit on what you want to
accomplish whether this will do much good. Code needs maintenance. Yes,
SQL code needs maintenance too.
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #4
rkc

"r0adh0g" <ro*****@nospam.phreaker.net> wrote in message
news:40********@news.binaries.net...
Instead of using an array consider creating your own variable type:
VBA (Access 95 onwards) allows you to return an entire structure of values. In database terms, this is analogous to returning an entire record rather
than a single field. For example, imagine an accounting database that needs to summarize income by the categories Wages, Dividends, and Other. VBA
allows you to declare a user-defined type to handle this structure:

Public Type Income
Wages As Currency
Dividends As Currency
Other As Currency
Total As Currency
End


If you were to want to work with multiple instances of a udt learning about
arrays or even collections would be a valid goal.


Nov 12 '05 #5
Hi,

That example only demonstrates how to store a SINGLE dataset, which would
not be the same as an array.

--
Calvin Smith
http://www.CalvinSmithSoftware.com - Automation Code
http://www.SpanglesNY.com - Fendi, Prada, Von Dutch, etc - 60% off
"r0adh0g" <ro*****@nospam.phreaker.net> wrote in message
news:40********@news.binaries.net...
Instead of using an array consider creating your own variable type:
VBA (Access 95 onwards) allows you to return an entire structure of values. In database terms, this is analogous to returning an entire record rather
than a single field. For example, imagine an accounting database that needs to summarize income by the categories Wages, Dividends, and Other. VBA
allows you to declare a user-defined type to handle this structure:

Public Type Income
Wages As Currency
Dividends As Currency
Other As Currency
Total As Currency
End TypeYou can now use this structure as the return type for a
function. In a real situation, the function would look up your database
tables to get the values, but the return values would be assigned like this:
Function GetIncome() As Income
GetIncome.Wages = 950
GetIncome.Dividends = 570
GetIncome.Other = 52
GetIncome.Total = GetIncome.Wages + GetIncome.Dividends +
GetIncome.Other
End FunctionTo use the function, you could type into the Immediate
Window:

? GetIncome().Wagesor you could include a text box on a report and set
its ControlSource property to:

= GetIncome().Total(Note: the use of "Public" in the Type declaration
gives it sufficient scope.)

Programmers with a background in C will instantly recognize the
possibilities now that user-defined types can be returned from functions. If you're keen, user-defined types can even be based on other user-defined
types.
"Norman Fritag" <mt*****@ozemail.com.au> wrote in message
news:%w****************@nnrp1.ozemail.com.au...


Nov 12 '05 #6

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

Similar topics

53
by: Alf P. Steinbach | last post by:
So, I got the itch to write something more... I apologize for not doing more on the attempted "Correct C++ Tutorial" earlier, but there were reasons. This is an UNFINISHED and RAW document,...
1
by: mirko | last post by:
How can I collect infos about the caller class of a custom class library (dll), directly by the class library itself? I tried using the StackTrace class inside the class library, but the last...
1
by: linda.s | last post by:
Is there any detailed debug tutorial for Pythonwin?
8
by: EPPack | last post by:
I have a full, legal copy of Visual Studio.net 2003 on my work machine, I don't need the free product that was suggested , (unless it has a built in tutorial). However, I have no major clue how to...
13
by: Grant Edwards | last post by:
I need to interpolate an irregularly spaced set of sampled points: Given a set of x,y,z points, I need to interpolate z values for a much finer x,y grid. I tried using the scipy sandbox delaunay...
7
by: Turbo | last post by:
I have a written a detailed html tutorial here:- http://sandy007smarty.seo.iitm.ac.in/2006/09/26/html-tutorial/ I know there are a couple of html tutorials out there. But its a tutorial without...
17
Motoma
by: Motoma | last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/. Introduction:...
2
Banfa
by: Banfa | last post by:
Posted by Banfa The previous tutorial discussed what programming is, what we are trying to achieve, the answer being a list of instructions constituting a valid program. Now we will discuss how...
182
by: Bill Cunningham | last post by:
I understand this code. int a; int b; for (b=0;b<5;b=b+1) int a; This should take every element of the array a and set it to 1,2,3,4,5. Great. Now for the big question. How would you work...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.