?
Solved

Error 2100 while accessing a variable multiple times

Posted on 2003-03-21
10
Medium Priority
?
290 Views
Last Modified: 2010-05-18
In this form I have created, it has several check boxes. When the checkbox is checked a few other things will appear. I need to keep track of how many items are checked. Right now I am using a global variable called Total. Total is either increments or de-increments by one depending if a user is checking or unchecking a box.

I notice that when the form opens, it runs all of the code regardless of an event has actually been executed. In my code I change Total at many different places, but once it hits the seventh one it gives me an error 2100 "The control or subform control is too large for this location."

To better explain this I have the following function:
Sub position(d)
    If d = "-" Then
        Total = Total - 1
    Else
        Total = Total + 1
    End If
    MsgBox Total
End Sub
When ever I need to change this value of Total I call this function. Anyway, at startup, I get this message 7 times with the value of -1 and going to -7. After -7 it shoots that error at me.
0
Comment
Question by:vable
[X]
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
  • 6
  • 2
  • 2
10 Comments
 
LVL 18

Expert Comment

by:1William
ID: 8183367
What is firing off you code?  
0
 

Author Comment

by:vable
ID: 8183404
I don't exactly know what you are asking me. If you mean is executing my code then its the form itself when it opens. When the form opens it tries to execute all of the code.
I call the function may times in my code.
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 8183451
Do you also have a control on your form called Total ? If so, you may need to change either the control name or the name of your variable.

However, try running the form without executing your position function. It may actually be something else that is causing the error, not the function.
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 18

Accepted Solution

by:
1William earned 1000 total points
ID: 8183458
On load, there is no data.  If you want to check the current record, then that is a better place.
0
 

Author Comment

by:vable
ID: 8183464
I don't exactly know what you are asking me. If you mean is executing my code then its the form itself when it opens. When the form opens it tries to execute all of the code.
I call the function may times in my code.
0
 

Author Comment

by:vable
ID: 8183521
I don't exactly know what you are asking me. If you mean is executing my code then its the form itself when it opens. When the form opens it tries to execute all of the code.
I call the function may times in my code.
0
 

Author Comment

by:vable
ID: 8183534
I don't exactly know what you are asking me. If you mean is executing my code then its the form itself when it opens. When the form opens it tries to execute all of the code.
I call the function may times in my code.
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 8183582
Vable, don't click the refresh button - this re-submits your comment. Use the "Reload this question" link in the top left hand corner instead - and see my comment above re the Total control.
0
 

Author Comment

by:vable
ID: 8183615
Okay, I don't know why my comment is being entered in every single time I access this page....anyway that is for the people who manages this site.

I renamed the Total value to Tota and the same thing happens.

In my Form_Open function I do call another function which calles all of the other function and each of these call the position(d) function many of times. Since nothing is check that value de-increments. But only to -7. That looks like my problem. I guess I should have looked at that function a little more carefully.
0
 

Author Comment

by:vable
ID: 8183622
Looks like 1William got my attention to the form_load function. So, I will award him the points. Thank you much for helping me out.

Vable
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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