Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Using an Array from Dif Forms
Jerry Fowler 
       
2 years ago
I'm writing a Cashdrawer Database and I'm wondering how to load and Access Arrays from other forms. I have a form "CashDrawerF" and it shows the 20 cash drawers we count. Currently when I double click on the cash drawer Total I'm taken to the form "CountDrawerF" where it shows 8 fields as this company likes to know the number of ones, fives, and so on. When the first form loads I create the Array "CDArray" using

Dim CDArray (20,8) as Variant

When I am done counting the drawer and have filled in the fields on the CountDrawerF I would like to load the CDArray that was created on the First form.

I have tried using the Forms!"formname".CDArray(x,y) = OnesAmt but I get a Function or Sub was not defined error

Any Ideas or direction for a Video would be greatly appreciated.
Adam Schwanz  @Reply  
           
2 years ago
I think you'd have to use a module rather than a sub or function.

Also, just making sure you know arrays are zero based, so you actually have a 21 by 9 array (just mentioning because you said you have 20 cash drawers, might actually want to use 19,7)
Jerry Fowler OP  @Reply  
       
2 years ago
Thanks on both accounts, I had forgotten Arrays are zero based, and I'll try using a module.
Jerry Fowler OP  @Reply  
       
2 years ago
Adam I gave it a go for a Modular but still getting the Sub or Function is not defined error.

When I load the first form the onload event calls CreateArray, then I double click on the first drawer and it opens the Second form, then when done filling it in I click on Submit command button and it runs the LoadArray from the module. I'm attaching two screenshots.
Jerry Fowler OP  @Reply  
       
2 years ago

Jerry Fowler OP  @Reply  
       
2 years ago

Kevin Robertson  @Reply  
          
2 years ago
You need to declare the Array() outside of all Subs and make a call to CreateArray() in the LoadArray() Sub Routine. A simplified example is in my image below.

Scope
Kevin Robertson  @Reply  
          
2 years ago

Jerry Fowler OP  @Reply  
       
2 years ago
So does declaring the Array outside the subroutines makes it more available to the subs? Am I getting that correctly? Thanks for showing this

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 11:36:20 PM. PLT: 1s