Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BERMUDA TRIANGLE IN MY REPORT - Executing 3 times a Format Section Sub

Status
Not open for further replies.

dafi

Programmer
Joined
Apr 19, 2001
Messages
25
Location
RO
Can anyone explain me why a sub that formats a section in the detail part is running three times per recorset or per row, i'm confused ? ?

I needeed to do something like

sub format_blahblah
if field_in_db_mapped_on_a_field_inreport.Value = true
other_field_in_report.SetText "ok it's good"
else
other_field_in_report.SetText "it's bad,bad,bad"
endif

end sub

and in database is
field_in_db_mapped_on_a_field_inreport.Value = true
for first record
true
for second record
false
for the third record

in the end, the messages
are
"it's bad,bad,bad"
"it's bad,bad,bad"
"it's bad,bad,bad"

so i tried also on a query with 8 records and it also runed for 3 times.


I tried to use a counter that has disabled exec of sub after
first execution and the first value keeped the value
"ok it's good"

it's very strange and I wonder if I can ever see the sun anymore ...
 
BTW, you can't change values in the database using CR, but you can set values for variables and share them across formulas, susbstituting those formulas for the fields.

-k kai@informeddatadecisions.com
 
I finnaly I made it work !!!
I still don't know why it executes 3 times the sub, but I passed the problem.

And the answer is NEVER try

field_in_db_mapped_on_a_field_inreport.Value = True

BUT YOU SHOULD

field_in_db_mapped_on_a_field_inreport.Value = "True"
 
yeah, i've noticed ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top