Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Error 2100 while accessing a variable multiple times

Posted on 2003-03-21
10
Medium Priority
?
296 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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

572 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