I have a very bizarre error. The values for the New_Male_Sub, etc won't set
to the field that I am assigning it to. I run through the code and it stay
zero. It does set if I add a breakpoint for the line where I assign it.
Huh? It makes no sense. What am I doing wrong, any help is appreciated.
Dim New_Males_Sub As Integer
Dim New_Females_Sub As Integer
Dim New_Unknowns_Sub As Integer
New_Males_Sub = 0
New_Females_Sub = 0
New_Unknowns_Sub = 0
New_Males_Sub = [Sum_Location_New_Tanks_TotalMales]
New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
What are [Sum_Location_New_Tanks_TotalMales],
[Sum_Location_New_Tanks_TotalFemales] and
[Sum_Location_New_Tanks_TotalUnknown] supposed to be?
If they're controls on your form, prefix them with Me.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> I have a very bizarre error. The values for the New_Male_Sub, etc won't
> set
[quoted text clipped - 14 lines]
> New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
> New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Can - 21 Nov 2006 21:06 GMT
Made the changes. Tried a couple of variations with square breackets and
.value ... still doesn't work. :-(
> What are [Sum_Location_New_Tanks_TotalMales],
> [Sum_Location_New_Tanks_TotalFemales] and
[quoted text clipped - 20 lines]
> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Douglas J. Steele - 22 Nov 2006 13:07 GMT
You didn't answer my question. What are [Sum_Location_New_Tanks_TotalMales],
[Sum_Location_New_Tanks_TotalFemales] and
[Sum_Location_New_Tanks_TotalUnknown] supposed to be?

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Made the changes. Tried a couple of variations with square breackets and
> .value ... still doesn't work. :-(
[quoted text clipped - 26 lines]
>> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
>> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Can - 22 Nov 2006 16:31 GMT
Whoops, they are controls on my form. I am just confused why would code not
work then start working when the only difference is putting a burgundy dot
beside it to step through the code.
When I put the break after it and put my mouse over the code that isn't
working it will give values like
New_Males_Sub = [Sum_Location_New_Tanks_TotalMales]
0 = 2
It will read the correct value for [Sum_Location_New_Tanks_TotalMales] but
not set New_Males_Sub to it unless I put the break in.
Huh?
> You didn't answer my question. What are [Sum_Location_New_Tanks_TotalMales],
> [Sum_Location_New_Tanks_TotalFemales] and
[quoted text clipped - 30 lines]
> >> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
> >> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Douglas J. Steele - 22 Nov 2006 22:17 GMT
Not sure I understand what you're describing.
When you mouse over the code, New_Males_Sub won't be set to 2 until the line
has finished executing.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Whoops, they are controls on my form. I am just confused why would code
> not
[quoted text clipped - 48 lines]
>> >> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
>> >> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Can - 23 Nov 2006 04:50 GMT
Yes I understand that. I put my burgundy dot within the function after that
line to read the values of the line in question (putting my mouse over it).
When I also put the burgundy dot on the line in question the line executes.
If I don't put the burgundy dot on the line in question, the line does not
execute. The burgundy dot is the only difference. In 8 years of working in
Access / VBA I've never seen this. I am confused.
Candace
> Not sure I understand what you're describing.
>
[quoted text clipped - 53 lines]
> >> >> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
> >> >> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Douglas J. Steele - 23 Nov 2006 12:04 GMT
Sorry, I haven't seen it either.
You might try creating a new form, and copying everything from the old one
to the new one, just in case it's mild corruption.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Yes I understand that. I put my burgundy dot within the function after
> that
[quoted text clipped - 74 lines]
>> >> >> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
>> >> >> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Can - 23 Nov 2006 16:12 GMT
Tried it and no luck. Any other ideas?
:-(
> Sorry, I haven't seen it either.
>
[quoted text clipped - 79 lines]
> >> >> >> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
> >> >> >> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Douglas J. Steele - 23 Nov 2006 16:19 GMT
Sorry, no.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Tried it and no luck. Any other ideas?
>
[quoted text clipped - 92 lines]
>> >> >> >> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
>> >> >> >> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Can - 23 Nov 2006 17:31 GMT
I got it working. I took the code out of that sub and put it in it's own.
Then I call that new sub within the original sub and it works great ....
silly but it works so I am happy.
:-D
> Sorry, no.
>
[quoted text clipped - 94 lines]
> >> >> >> >> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
> >> >> >> >> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Check to see if you have that variable also dimmed at the module level.
> I have a very bizarre error. The values for the New_Male_Sub, etc won't set
> to the field that I am assigning it to. I run through the code and it stay
[quoted text clipped - 12 lines]
> New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
> New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]
Can - 21 Nov 2006 21:08 GMT
Nope but the sub is public. I had used the varaible same names in another
function so I added the _Sub
> Check to see if you have that variable also dimmed at the module level.
>
[quoted text clipped - 14 lines]
> > New_Females_Sub = [Sum_Location_New_Tanks_TotalFemales]
> > New_Unknowns_Sub = [Sum_Location_New_Tanks_TotalUnknown]