Report If Statement Problem

M

magmike

I am trying to outline fields on a report that are empty, to remind
the user to get that information when they visit the client. I'm new
to coding reports, and what I am trying is not working. Here is my
code:

If Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary Is Null Then
Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary.BorderStyle = "Solid"
End If

Thanks in advance!

magmike
 
M

magmike

I am trying to outline fields on a report that are empty, to remind
the user to get that information when they visit the client. I'm new
to coding reports, and what I am trying is not working. Here is my
code:

If Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary Is Null Then
    Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary.BorderStyle = "Solid"
End If

Thanks in advance!

magmike

PS - I am using the OnOpen event of the Report
 
B

BruceM

To assure Access (and you) don't get confused, make sure the Anniversary
field and text box have different names. You could use txtAnniversary for
the text box name.

If txtAnniversary is in the report's Detail section, try something like this
in the Detail section's Format event:

If IsNull(Me.Anniversary) Then
Me.txtAnniversary.BorderStyle = 1
Else
Me.txtAnniversary.BorderStyle = 0
End If

This should set the border to solid if Anniversary is null, and to
transparent otherwise.

I am trying to outline fields on a report that are empty, to remind
the user to get that information when they visit the client. I'm new
to coding reports, and what I am trying is not working. Here is my
code:

If Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary Is Null Then
Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary.BorderStyle = "Solid"
End If

Thanks in advance!

magmike

PS - I am using the OnOpen event of the Report
 
M

magmike

To assure Access (and you) don't get confused, make sure the Anniversary
field and text box have different names.  You could use txtAnniversary for
the text box name.

If txtAnniversary is in the report's Detail section, try something like this
in the Detail section's Format event:

If IsNull(Me.Anniversary) Then
    Me.txtAnniversary.BorderStyle = 1
    Else
        Me.txtAnniversary.BorderStyle = 0
End If

This should set the border to solid if Anniversary is null, and to
transparent otherwise.


I am trying to outline fields on a report that are empty, to remind
the user to get that information when they visit the client. I'm new
to coding reports, and what I am trying is not working. Here is my
code:
If Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary Is Null Then
Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary.BorderStyle = "Solid"
End If
Thanks in advance!

PS - I am using the OnOpen event of the Report

Thanks, that worked. I also have a form I am trying to do this on.
Where I am confused, is on the form (actually it's a subform) I simply
use an unbound text field with a concantenated (sp?) expression. I
want to format that text box based on two different Yes/No fields. How
do I do that?

Thanks in advance!
magmike
 
B

BruceM

The term is "concatenated" (you were close, and I knew what you meant.

You would use similar code in the form's Current event, maybe something
like:

If Me.YesNo1 = True Then
If Me.YesNo2 = True Then
Me.YourTextBox.BackColor = vbBlue
Else
Me.YourTextBox.BackColor = vbWhite
End If
Else
If Me.YesNo2 = True Then
Me.YourTextBox.BackColor = vbRed
Else
Me.YourTextBox.BackColor = vbGreen
End If
End If

I don't know just what you want to do for formatting with the four different
possiblilites presented by two Yes/No fields, but this is the general idea
of the logic.

Controls on forms have conditional formatting (as do reports), but the
border is not one of the things you can format that way, so the code is
needed. However, for BackColor and a few other things you could use
Conditional Formatting.

To assure Access (and you) don't get confused, make sure the Anniversary
field and text box have different names. You could use txtAnniversary for
the text box name.

If txtAnniversary is in the report's Detail section, try something like
this
in the Detail section's Format event:

If IsNull(Me.Anniversary) Then
Me.txtAnniversary.BorderStyle = 1
Else
Me.txtAnniversary.BorderStyle = 0
End If

This should set the border to solid if Anniversary is null, and to
transparent otherwise.


I am trying to outline fields on a report that are empty, to remind
the user to get that information when they visit the client. I'm new
to coding reports, and what I am trying is not working. Here is my
code:
If Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary Is Null Then
Report![ProspectTableSingleRecord]![Company subform].Report!
Anniversary.BorderStyle = "Solid"
End If
Thanks in advance!

PS - I am using the OnOpen event of the Report

Thanks, that worked. I also have a form I am trying to do this on.
Where I am confused, is on the form (actually it's a subform) I simply
use an unbound text field with a concantenated (sp?) expression. I
want to format that text box based on two different Yes/No fields. How
do I do that?

Thanks in advance!
magmike
 

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