Code skipping records where criteria are met

C

Curmudgeon

I have a simple statement

If T.Summary = True Then

If (T.Start2 <> "NA" And T.Start2 < T.Start) Or (T.Finish2 <> "NA" And
T.Finish2 > T.Finish) Then
T.Flag20 = True
Else
T.Flag20 = False
End If

End If

This works properly for the great majority of records in my file.
However, there are several records that precisely match the criteria,
but the code fails to set the flag as expected. This appears to be
happening in summary rows in which the Start2/Finish2 dates are being
rolled up from several outline levels lower.

I'm using Flag20 to suppress display of a rolled up summary bar
(Start2-Finish2) if it does not extend beyond the Start-Finish summary
bar.

I have tested each criterion separately for each record, and the
criteria are met in each case; however, the flag does not get set.

Any clues would be appreciated
Thanks
Dave
 
J

John

Curmudgeon said:
I have a simple statement

If T.Summary = True Then

If (T.Start2 <> "NA" And T.Start2 < T.Start) Or (T.Finish2 <> "NA" And
T.Finish2 > T.Finish) Then
T.Flag20 = True
Else
T.Flag20 = False
End If

End If

This works properly for the great majority of records in my file.
However, there are several records that precisely match the criteria,
but the code fails to set the flag as expected. This appears to be
happening in summary rows in which the Start2/Finish2 dates are being
rolled up from several outline levels lower.

I'm using Flag20 to suppress display of a rolled up summary bar
(Start2-Finish2) if it does not extend beyond the Start-Finish summary
bar.

I have tested each criterion separately for each record, and the
criteria are met in each case; however, the flag does not get set.

Any clues would be appreciated
Thanks
Dave

Dave,
Off the top of my head, it looks like it should work and a little test
run on my end confirms that it should work. I assume you set the rollup
of Start2 and Finish2 by customizing those fields with a minimum and
maximum rollup respectively.

What happens when you step through the code, particularly at the summary
lines where it doesn't seem to work? Take a look at the variables in
your formula at a summary line that "fails". There are various ways to
do that but one of the easiest is to hover your mouse over the variable.

John
Project MVP
 
C

Curmudgeon

Dave,
Off the top of my head, it looks like it should work and a little test
run on my end confirms that it should work. I assume you set the rollup
of Start2 and Finish2 by customizing those fields with a minimum and
maximum rollup respectively.

What happens when you step through the code, particularly at the summary
lines where it doesn't seem to work? Take a look at the variables in
your formula at a summary line that "fails". There are various ways to
do that but one of the easiest is to hover your mouse over the variable.

John
Project MVP- Hide quoted text -

- Show quoted text -

John,
Yes, the Start/Finish2 values are rolled up using min/max. When I
examine each variable in the problem records, the values correspond to
those shown in the table, however, for some reason the code ignores
them and fails to set the flag. When I compare records that work with
records that don't I fail to see any difference. It's a mystery to
me...
Thanks
Dave
 
J

John

Curmudgeon said:
John,
Yes, the Start/Finish2 values are rolled up using min/max. When I
examine each variable in the problem records, the values correspond to
those shown in the table, however, for some reason the code ignores
them and fails to set the flag. When I compare records that work with
records that don't I fail to see any difference. It's a mystery to
me...
Thanks
Dave

Dave,
The only other thing that popped into my mind after I responded the
first time is that your code probably won't do what you want if you are
running it against a dynamically consolidated master file.

Assuming you are not using a master file, I'd be happy to take a look at
your file to find out what is going on. My address is below. I will ask
a few questions. If you send your file, be sure to also send your
complete VBA code.

John
Project MVP
jensenj6atatcomcastdotdotnet
(remove obvious redundancies)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top