Problems in my Details section

P

Patrick

HI!!

I'm using the 'detail section' of my 'Warranty' report to
check if my expiration date is issued.

this is the code I'm using:
*******************************
On Error Resume Next

CurDate = Date


d = DateExp.Value
result = DateDiff("m", d, CurDate)

If result >= 3 Then
' backColor is changed to gray.
DateExp.BackColor = 12632256
Else
' hides the one not coresponding to the if.
desc1.Visible = False
NbrYrs1.Visible = False
DateExp.Visible = False
Exp1 = True

End If
**************************************
This code is repeated 9 more times.
And each time, if the result is not >=3 I asign
a boolean(Exp1 to exp10).

What I would like to do is if all my Exp 1 to 10 are TRUE
then I would like to skip that record and go to the next
one without having-it printed.I don't want him to show on
report.

Right know, if there all egual to TRUE it still prints
part of the information, but I don't realy need-it.

Can anyone help me make sence of this Please!

Patrick....
 
M

Marshall Barton

Patrick said:
I'm using the 'detail section' of my 'Warranty' report to
check if my expiration date is issued.

this is the code I'm using:
*******************************
On Error Resume Next

CurDate = Date


d = DateExp.Value
result = DateDiff("m", d, CurDate)

If result >= 3 Then
' backColor is changed to gray.
DateExp.BackColor = 12632256
Else
' hides the one not coresponding to the if.
desc1.Visible = False
NbrYrs1.Visible = False
DateExp.Visible = False
Exp1 = True

End If
**************************************
This code is repeated 9 more times.
And each time, if the result is not >=3 I asign
a boolean(Exp1 to exp10).

What I would like to do is if all my Exp 1 to 10 are TRUE
then I would like to skip that record and go to the next
one without having-it printed.I don't want him to show on
report.

Right know, if there all egual to TRUE it still prints
part of the information, but I don't realy need-it.

I'm not at all sure that I followed all that, but I'll give
it a try anyway. The code you posted appears to do the
exact same thing for all the desc and NbrYrs1 controls
since, as far as I can see, all 10 of the DateDiff - If
lines depend on the same value, so I can't really make sense
of it.

Are the Exp1-10 fields in the table or just unbound controls
on the report? If they are fields in the table, then you
should use the report's record source query to filter out
the records where they're all true.

If the Exp1-10 are variables DIMmed in the report's module,
then add another variable called AllExp and a line of code
in each block to keep track if any are false:

Dim AllExp As Boolean
. . .
AllExp = Exp1
. . .
AllExp = AllExp And Exp2
. . .
. . .
AllExp = AllExp And Exp10

then, at the end of the procedure, you can suppress the
detail in one of several ways. Try this:
Cancel = AllExp
or this
Me.PrintSection = Not AllExp

If that is off base, then I think I'll have to see more of
the code and have a little more explanation about the data
tables/fields.
 

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