Accessing another forms variables... easy on again lol

Posted on 2003-03-25
Medium Priority
Last Modified: 2010-05-01
I have a form called frmMaintainCustomerDetails which has a multi-dimensional array Customer(100, 13).

Im in a form called frmMaintainPropertyDetails and i want to access Customer(i, 0) in the form above... how???

I told the guys at uni we should have done our prototype in Java!!!!

Question by:zero303
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

Expert Comment

ID: 8205262
Declare Customer with Public (instead of Dim) in frmMaintainCustomerDetails

Then, in frmMaintainPropertyDetails you can use frmMaintainCustomerDetails.Customers(i, 0)

That's all, hope this helps you.

Expert Comment

ID: 8205309
Actually, you can't define arrays as project level variables.

Expert Comment

ID: 8205431
In frmMaintainCustomerDetails add this code

Public Property Get Customer(ByVal Index1 as integer, ByVal Index2 as integer) as String
   Customer = Customers(Index1,Index2)
End Property

Public Property Let Customer(ByVal Index1 as integer, ByVal Index2 as integer, Byval StrCustomer as String)
   Customers(Index1,Index2) = StrCustomer
End Property

I think that is what you require.

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!


Accepted Solution

zero303 earned 0 total points
ID: 8205470
OK i solved it... i made a public sub and a public string called custStore

public sub getCustomerInfo (i as integer, j as integer)
custStore = Customer(i, j)
end sub

then in my property form i call frmMaintainCustomerDetails.getCustomerInfo(i, j)

then i can refer to frmMaintainCustomerDetails.custStore which now holds which ever piece of data in my array that i asked for...

thanks anyway guys...


Expert Comment

ID: 8210345

I was wrong indeed, you cannot declare an array public in a form.
But you can in a module, so an easier solution is:
add a module and declare Customer in the module (not in frmMaintainCustomerDetails):
Public Customer(100, 13) As String

Then, you can give it values in frmMaintainCustomerDetails  and access them in frmMaintainPropertyDetails by just using Customer(..., ...)

Expert Comment

ID: 8531625
Hi zero303,
This old question (QID 20562780) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 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