Conditional format -- other fields including border

G

Guest

I'm attempting to add a conditional format so that the "border" becomes
transparent if the value of a text boxis equal to "Y". If the value is other
than "Y", then I want the border to show up.

I've attempted this code to no avail:

'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' IIf(IsNull(Me.Tickbox),Me.BorderStyle.Tickbox = "0",
me.borderstyle.tickbox = "2")

'End Sub

Any suggestions?
 
F

fredg

I'm attempting to add a conditional format so that the "border" becomes
transparent if the value of a text boxis equal to "Y". If the value is other
than "Y", then I want the border to show up.

I've attempted this code to no avail:

'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' IIf(IsNull(Me.Tickbox),Me.BorderStyle.Tickbox = "0",
me.borderstyle.tickbox = "2")

'End Sub

Any suggestions?

Change the border of a text control or label control?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.[SomeField] = "Y" Then
Me.[CongtrolName].BorderStyle = 0 ' transparent
Else
Me.[ControlName].BorderStyle = 2 ' dashes
End If
End Sub

The above assumes the datatype of [SomeField] is text.

Note: If you are trying to change the borderstyle of a check box, you
can't.
 
G

Guest

thank you, Fred, it appears to be working, but sporadically.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.[Tickbox] = "Y" Then
Me.[Tickbox].BorderStyle = 0 ' transparent
Else
Me.[Tickbox].BorderStyle = 1 ' solid
End If
End Sub

___

Is it possible that the "controlname" as noted in the 2nd and 3rd references
above should not be the name I gave the text box in its "text box name
field"? Should I be using the text "controlname" literally?

The problem seems to be that

fredg said:
I'm attempting to add a conditional format so that the "border" becomes
transparent if the value of a text boxis equal to "Y". If the value is other
than "Y", then I want the border to show up.

I've attempted this code to no avail:

'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' IIf(IsNull(Me.Tickbox),Me.BorderStyle.Tickbox = "0",
me.borderstyle.tickbox = "2")

'End Sub

Any suggestions?

Change the border of a text control or label control?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.[SomeField] = "Y" Then
Me.[CongtrolName].BorderStyle = 0 ' transparent
Else
Me.[ControlName].BorderStyle = 2 ' dashes
End If
End Sub

The above assumes the datatype of [SomeField] is text.

Note: If you are trying to change the borderstyle of a check box, you
can't.
 
G

Guest

Does the field need to be "cleared" for the next record?

fredg said:
I'm attempting to add a conditional format so that the "border" becomes
transparent if the value of a text boxis equal to "Y". If the value is other
than "Y", then I want the border to show up.

I've attempted this code to no avail:

'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' IIf(IsNull(Me.Tickbox),Me.BorderStyle.Tickbox = "0",
me.borderstyle.tickbox = "2")

'End Sub

Any suggestions?

Change the border of a text control or label control?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.[SomeField] = "Y" Then
Me.[CongtrolName].BorderStyle = 0 ' transparent
Else
Me.[ControlName].BorderStyle = 2 ' dashes
End If
End Sub

The above assumes the datatype of [SomeField] is text.

Note: If you are trying to change the borderstyle of a check box, you
can't.
 
F

fredg

thank you, Fred, it appears to be working, but sporadically.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.[Tickbox] = "Y" Then
Me.[Tickbox].BorderStyle = 0 ' transparent
Else
Me.[Tickbox].BorderStyle = 1 ' solid
End If
End Sub

___

Is it possible that the "controlname" as noted in the 2nd and 3rd references
above should not be the name I gave the text box in its "text box name
field"? Should I be using the text "controlname" literally?

The problem seems to be that

fredg said:
I'm attempting to add a conditional format so that the "border" becomes
transparent if the value of a text boxis equal to "Y". If the value is other
than "Y", then I want the border to show up.

I've attempted this code to no avail:

'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' IIf(IsNull(Me.Tickbox),Me.BorderStyle.Tickbox = "0",
me.borderstyle.tickbox = "2")

'End Sub

Any suggestions?

Change the border of a text control or label control?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.[SomeField] = "Y" Then
Me.[CongtrolName].BorderStyle = 0 ' transparent
Else
Me.[ControlName].BorderStyle = 2 ' dashes
End If
End Sub

The above assumes the datatype of [SomeField] is text.

Note: If you are trying to change the borderstyle of a check box, you
can't.

Change [ControlName] to the actual name of the control, so [TickBox]
is correct.
The code assumes that [TickBox] is a Text datatype control, and that
the value "Y" is a text value. It works fine for me.

If this still creates a problem, your difficulty is elsewhere.
Perhaps the actual value in the field is not a "Y" but a lookup
number?
In that case change the code to
If [TickBox] = n Then
where n is the actual lookup number that "Y" represents.
 

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