The Syntax was visible when you viewed the report????
Are you, by any chance, putting this code into a text box?
If yes, take it out.
In Design View Click on the grey bar above the white section that contains
your control (ie your fp-crwn6-y4 field/textbox).
Click on the Properties box on the toolbar. At the top of the Properties box
window you should something like GroupHeader0 or Detail.
Click on the Event tab
Click the down arrow next to the line that says On Format
Choose Event Procedure
Click the grey area to the right of that (3 dots will appear in the grey
bar)
You will see something like this appear on a code page
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
End Sub
The first line may have something other than GroupHeader0 if your Control is
in the details section but it will look similar
Paste the code between the 2 lines so that the whole thing says something
like
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
If Me.GradePlaceHolder1 = True Then
Me.[fp-crwn6-y4].ForeColor = 255
Else
Me.[fp-crwn6-y4].ForeColor = 0
End If
End Sub
Now open your report. We WILL crack this Jeff!
Evi
Jeff@Tufts said:
Then this happened.
"If "m"e.Gra"d"ePla"c\eh"ol"d"er1 = True T"h\en
m"e.fp-"c\rwn"6-"y"4.Fore"c"olor = 255 El"s"e
"m"e.fp-"c\rwn"6-"y"4.Fore"c"olor = 0 E"
Jeff@Tufts said:
This is what happened.
"If (Gra"d"ePla"c\eh"ol"d"er1 = True) T"h\en" (fp-"c\rwn"6-"y"4.Fore"c"olor
= 255) El"s"e (fp-"c\rwn"6-"y"4.Fore"c"olor = 0) E"nd" I"
:
Would it look like this?
If Me.GradePlaceHolder1 = True Then Me.fp-crwn6-y4.ForeColor = 255 Else
Me.fp-crwn6-y4.ForeColor = 0 End If
It seems like I'm missing all the ( ) & [ ] and stuff?????
:
No, I wasn't being 'leary' as my son says. I'm still learning too and
finding out new things. I thought you'd learnt a new way of using IIF which
could have been useful to me.
Until I read one of Allan Browne's recent emails, I didn't know that Access
had a version of Excel's SumIf for True/False answers (other than the DSum
function) in expressions like
= - Sum([Gender] = "M")
which counts all the times Gender = M.
I learnt most of the little I know from the newsgroups and Access 97's Help
file and through doing practical projects. I haven't been able to afford
most of the books you get on Access but of the ones I looked at, some were
so basic as to be impractical and others were so complex that I had no idea
what they were on about. I'm sure there are some recent ones out there,
especially those written by the Access MVPs which will fill that gap.
Evi
I think you completely understand, however, I'm new to access and have no
idea how to write code. Right now it's a foreign language.
I did replace the names, but I don't think I used the appropriate
commands -
([])= etc.
Would you recommend any books that could help me learn the language?
Thanks,
Jeff
:
Remember, Jeff, you have to replace MyCheck and MyNumber with the names
of
your checkBox field and your number field.
Are you OK with that?
Are you puttting the code in the On Format Event of the report? It goes
just
under the line which says (according to what section you put it in)
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
(if you put the code in the Detail section of the report)
or
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As
Integer)
if you put the code in a Header section of the report.
What do you mean that the Syntax is all garbled? This code does work.
Or have I misunderstood what you require?
Evi
It didn't, I wrote exactly what you did and when I recheck the syntax
it
was
all garbled.
:
Assuming the check box is a field in your table and not just in your
form:
We'll call it 'MyCheck' and your other field MyNumber
In the On Format Event of the section that contains the number field
type
If Me.MyCheck = True Then
Me.MyNumber.ForeColor = 255
Else
Me.MyNumber.ForeColor = 0
End If
Evi
Hi,
I have a created a check box (on the table, query & form). The
box
will
indicate that a number enter in another field is a place holder.
When
I
run
the report for that field I want the number (font) to be red IF
the
box
has
been checked.
How do I link the checkbox to the field in the report???
Thanks,
Jeff