Multiple Conditions, Syntax

  • Thread starter Thread starter Machaut
  • Start date Start date
M

Machaut

Hi,
I'm a complete novice in VB, and have failed with the examples already
presented in the group (I'm obviously missing something). So perhaps I can
get help with a specific example ;)
I have a form with three bound text boxes and want to change text color to
one control ([FullBlank]) based on the values in the other two ([InsProf]
and [OutProf]). I can't seem to get the syntax right.

Logical conditions:
If [OutProf]="F" then FullBlank.Forecolor=vbBlue
If [OutProf]=("R" OR "RD") then FullBlank.Forecolor=vbGreen
If ([OutProf]="FR" AND [InsProf]="FRBI" FullBlank.Forecolor=vbRed
Else FullBlank.Forecolor=vbBlack

There are actually about twelve different conditions, otherwise I'd use the
conditional formatting.

Any help would be appreciated,
Machaut

@ (NOT)

Optonline


..


net



(remove not to e-mail)
 
Hi,
I'm a complete novice in VB, and have failed with the examples already
presented in the group (I'm obviously missing something). So perhaps I can
get help with a specific example ;)
I have a form with three bound text boxes and want to change text color to
one control ([FullBlank]) based on the values in the other two ([InsProf]
and [OutProf]). I can't seem to get the syntax right.

Logical conditions:
If [OutProf]="F" then FullBlank.Forecolor=vbBlue
If [OutProf]=("R" OR "RD") then FullBlank.Forecolor=vbGreen
If ([OutProf]="FR" AND [InsProf]="FRBI" FullBlank.Forecolor=vbRed
Else FullBlank.Forecolor=vbBlack

There are actually about twelve different conditions, otherwise I'd use the
conditional formatting.

Any help would be appreciated,
Machaut

@ (NOT)

Optonline

.

net

(remove not to e-mail)

Place the code in the Report Section's (Detail ?) Format event:

If [OutProf]="F" then
FullBlank.Forecolor=vbBlue
ElseIf [OutProf]="R" OR [OutProf] = "RD" then
FullBlank.Forecolor=vbGreen
ElseIf [OutProf]="FR" AND [InsProf]="FRBI" Then
FullBlank.Forecolor=vbRed
Else
FullBlank.Forecolor=vbBlack
End If
 
fredg said:
Hi,
I'm a complete novice in VB, and have failed with the examples already
presented in the group (I'm obviously missing something). So perhaps I
can
get help with a specific example ;)
I have a form with three bound text boxes and want to change text color
to
one control ([FullBlank]) based on the values in the other two ([InsProf]
and [OutProf]). I can't seem to get the syntax right.

Logical conditions:
If [OutProf]="F" then FullBlank.Forecolor=vbBlue
If [OutProf]=("R" OR "RD") then FullBlank.Forecolor=vbGreen
If ([OutProf]="FR" AND [InsProf]="FRBI" FullBlank.Forecolor=vbRed
Else FullBlank.Forecolor=vbBlack

There are actually about twelve different conditions, otherwise I'd use
the
conditional formatting.

Any help would be appreciated,
Machaut

@ (NOT)

Optonline

.

net

(remove not to e-mail)

Place the code in the Report Section's (Detail ?) Format event:

If [OutProf]="F" then
FullBlank.Forecolor=vbBlue
ElseIf [OutProf]="R" OR [OutProf] = "RD" then
FullBlank.Forecolor=vbGreen
ElseIf [OutProf]="FR" AND [InsProf]="FRBI" Then
FullBlank.Forecolor=vbRed
Else
FullBlank.Forecolor=vbBlack
End If

This was one of the variations I tried.... I obviously am not putting the
code in the right place.
Would you be willing to give explicit instructions on where to find "Report
Section's (Detail ?) Format event:"?
I'm feeling a little stupid, but I can't seem to make this work.
Thanks for the help,
Machaut
 
fredg said:
Hi,
I'm a complete novice in VB, and have failed with the examples already
presented in the group (I'm obviously missing something). So perhaps I
can
get help with a specific example ;)
I have a form with three bound text boxes and want to change text color
to
one control ([FullBlank]) based on the values in the other two ([InsProf]
and [OutProf]). I can't seem to get the syntax right.

Logical conditions:
If [OutProf]="F" then FullBlank.Forecolor=vbBlue
If [OutProf]=("R" OR "RD") then FullBlank.Forecolor=vbGreen
If ([OutProf]="FR" AND [InsProf]="FRBI" FullBlank.Forecolor=vbRed
Else FullBlank.Forecolor=vbBlack

There are actually about twelve different conditions, otherwise I'd use
the
conditional formatting.

Any help would be appreciated,
Machaut

@ (NOT)

Optonline

.

net

(remove not to e-mail)

Place the code in the Report Section's (Detail ?) Format event:

If [OutProf]="F" then
FullBlank.Forecolor=vbBlue
ElseIf [OutProf]="R" OR [OutProf] = "RD" then
FullBlank.Forecolor=vbGreen
ElseIf [OutProf]="FR" AND [InsProf]="FRBI" Then
FullBlank.Forecolor=vbRed
Else
FullBlank.Forecolor=vbBlack
End If

This was one of the variations I tried.... I obviously am not putting the
code in the right place.
Would you be willing to give explicit instructions on where to find "Report
Section's (Detail ?) Format event:"?
I'm feeling a little stupid, but I can't seem to make this work.
Thanks for the help,
Machaut

In what section of the report have you placed the [FullBlank] control?
If you placed it in the Detail Section, show the Detail Section
property sheet. Click on the Event tab.
On the Format line, write [Event Procedure]
Click on the little button with the 3 dots that appears on that line.
When the code window opens the cursor will be flashing between 2
already written lines of code.
Write the code I gave you between those 2 lines.
Save the changes.

If you placed the [FullBlank] control in a Group Header, then use the
Group Header format event instead of the Detail Format event.
 
fredg said:
fredg said:
On Fri, 12 May 2006 10:47:05 -0700, Machaut wrote:

Hi,
I'm a complete novice in VB, and have failed with the examples already
presented in the group (I'm obviously missing something). So perhaps I
can
get help with a specific example ;)
I have a form with three bound text boxes and want to change text color
to
one control ([FullBlank]) based on the values in the other two
([InsProf]
and [OutProf]). I can't seem to get the syntax right.

Logical conditions:
If [OutProf]="F" then FullBlank.Forecolor=vbBlue
If [OutProf]=("R" OR "RD") then FullBlank.Forecolor=vbGreen
If ([OutProf]="FR" AND [InsProf]="FRBI" FullBlank.Forecolor=vbRed
Else FullBlank.Forecolor=vbBlack

There are actually about twelve different conditions, otherwise I'd use
the
conditional formatting.

Any help would be appreciated,
Machaut

@ (NOT)

Optonline

.

net

(remove not to e-mail)

Place the code in the Report Section's (Detail ?) Format event:

If [OutProf]="F" then
FullBlank.Forecolor=vbBlue
ElseIf [OutProf]="R" OR [OutProf] = "RD" then
FullBlank.Forecolor=vbGreen
ElseIf [OutProf]="FR" AND [InsProf]="FRBI" Then
FullBlank.Forecolor=vbRed
Else
FullBlank.Forecolor=vbBlack
End If

This was one of the variations I tried.... I obviously am not putting the
code in the right place.
Would you be willing to give explicit instructions on where to find
"Report
Section's (Detail ?) Format event:"?
I'm feeling a little stupid, but I can't seem to make this work.
Thanks for the help,
Machaut

In what section of the report have you placed the [FullBlank] control?
If you placed it in the Detail Section, show the Detail Section
property sheet. Click on the Event tab.
On the Format line, write [Event Procedure]
Click on the little button with the 3 dots that appears on that line.
When the code window opens the cursor will be flashing between 2
already written lines of code.
Write the code I gave you between those 2 lines.
Save the changes.

If you placed the [FullBlank] control in a Group Header, then use the
Group Header format event instead of the Detail Format event.
Thank you Fred... that did the trick exactly as I wanted :)
 
Back
Top