Solved

Initializing structure variables

Posted on 2008-06-19
1
127 Views
Last Modified: 2010-04-30
Hello!
I have a structure:
    Public Structure geardrive
        Public name As String
        Public gearaxis As Integer
        Public axison As Boolean
        Public speed As Double
        Public target As Double
    End Structure
and I initialize:
        Dim planets() As geardrive

The help files say I can initialize the variables on the same line, like this:
        planets().name = {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"}

but it give me an error under the parentheses: number of indeces is less than number of dimensions

and an error under the first bracket: Expression expected.

If I do it individually, it works: planets(0).name = "mercury"

What am I doing wrong in the same line version?  

Thanks,
Joy
0
Comment
Question by:fudgekitten
1 Comment
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 385 total points
Comment Utility
You can't do that and there is no convenient way to do what you want. Each member of the record and each record has to be set individually.

Kevin
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now